tarantool / document

Effortless JSON storage for Tarantool
BSD 2-Clause "Simplified" License
24 stars 4 forks source link

Documents are not returned with SQL interface #2

Open kkorsakov opened 6 years ago

kkorsakov commented 6 years ago

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
...
kyukhin commented 6 years ago

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.

knazarov commented 6 years ago

@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.

kkorsakov commented 6 years ago

Ok, thanks!