document icon indicating copy to clipboard operation
document copied to clipboard

Documents are not returned with SQL interface

Open kkorsakov opened this issue 8 years ago • 3 comments

Step to reproduce:

  1. Create space and insert documents as in sample tarantool> box.schema.create_space('TEST_DOC', {if_not_exists = true}) tarantool> doc.create_index(box.space.TEST_DOC, 'primary',{parts={'id', 'unsigned'}, if_not_exists=true}) tarantool> doc.insert(box.space.TEST_DOC, {id=1, foo="foo", bar={baz=3}})

  2. Verify that data is inserted tarantool> for _, r in doc.select(box.space.TEST_DOC) do print('tuple:', json.encode(r)) end

tuple:  {"bar":{"baz":3},"foo":"foo","id":1}
---
...
  1. Select data with SQL interface tarantool> box.sql.execute([[select * from TEST_DOC]]);

Expected: tuples with documents.

Actual: SQL error

- error: 'no such table: TEST_DOC'
...

Additional data: tarantool> box.sql.execute([[SELECT * FROM _space;]])

  - [528, 1, 'TEST_DOC', 'memtx', 0, !!binary gA==, !!binary k4OkdHlwZah1bnNpZ25lZKRuYW1lomlkq2lzX251bGxhYmxlwoOkdHlwZaZzY2FsYXKkbmFtZadiYXIuYmF6q2lzX251bGxhYmxlw4OkdHlwZaZzdHJpbmekbmFtZaNmb2+raXNfbnVsbGFibGXD]

tarantool> box.info.version

---
- 1.8.3-77-ge5b5dbc
...

kkorsakov avatar Jan 23 '18 10:01 kkorsakov

This is not implemented yet. Only those spaces created using SQL itself might be queried. We're now working on support of making well-formatted spaces visible from SQL. Well-formatted means at least:

  1. space_format should be specified for space
  2. primary index should be defined for space

Only those fields will be accessible from SQL which are defined in space_format.

kyukhin avatar Jan 23 '18 10:01 kyukhin

@kkorsakov So, basically you need to wait for this feature to land in the tarantool 1.8. After that you'll be able to perform the queries as you describe.

I'll leave the ticket open for now.

knazarov avatar Jan 23 '18 13:01 knazarov

Ok, thanks!

kkorsakov avatar Jan 23 '18 13:01 kkorsakov