feat: improve SQL results formatting in Lua
At the moment each engine (cartridge, picodata) returns SQL results as a Lua table with default formatting. We can make the results more readable for user if we patch the result table metatable's __serialize
field:
picodata> pico.sql([[select * from t]])
---
- metadata:
- {'name': 'A', 'type': 'integer'}
- {'name': 'B', 'type': 'integer'}
rows:
- [1, 2]
...
picodata> pico.sql([[explain select * from t]])
---
- - projection ("T"."A"::integer -> "A", "T"."B"::integer -> "B")
- ' scan "T"'
...
picodata> pico.sql([[insert into t values (2, 3)]])
---
- row_count: 1
...
Edited by Denis Smirnov