I have the following data structure format:
unix/:/var/run/tarantool/tarantool.sock> s:format()
---
- [{'name': 'id', 'type': 'unsigned'}, {'name': 'version', 'type': 'array'}, {'name': 'data',
'type': 'array'}]
...
And I have the following data already inside it:
unix/:/var/run/tarantool/tarantool.sock> s:select{}
---
- - [0, [[21, 'action123'], [12, 'actionXYZ'], [11, 'actionABC']], [['actionXYZ',
'SOME_JAVASCRIPT_CONTENT']]]
- [1, [[33, 'action123'], [12, 'baseXYZ'], [11, 'baseABC']], [['bas123', 'SOME_CSS_CONTENT']]]
...
I have read through the references and documentation and I'm a bit lost on completing the following:
What's the "WHERE" equivalent? ie. Select to find entries that have a version
of 12
Not seeing applicable examples in https://www.tarantool.io/en/doc/2.2/reference/reference_lua/box_space/#lua-function.space_object.select
List items with the field names (so I know what block I'm looking at). In a way, sort of like having "column headers" in your results in SQL.
I have named tuples in my
format()
- how can I see these names when I'm querying data?{'name': 'id', 'type': 'unsigned'}, {'name': 'version', 'type': 'array'}, {'name': 'data', 'type': 'array'}]
Pretty print! (preferably yaml)
I tried using https://www.tarantool.io/en/doc/2.2/reference/reference_lua/yaml/ to wrap around my select statements, but nothing was working.
https://www.tarantool.io/en/doc/2.2/reference/reference_lua/box_index/
tarantool> box.space.TEST:pairs():map(function(x) return x:tomap({names_only=true}) end):totable()
---
- - COLUMN1: 1
COLUMN2: a
- COLUMN1: 13
COLUMN2: a
- COLUMN1: 1000
COLUMN2: a