Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve data display in table/ttable mode #832

Open
LeonidVas opened this issue May 2, 2024 · 3 comments
Open

Improve data display in table/ttable mode #832

LeonidVas opened this issue May 2, 2024 · 3 comments
Assignees

Comments

@LeonidVas
Copy link
Collaborator

Improve data display in table/ttable mode by adding a format information (fields name).
Only for tarantool >= 3.0

@oleg-jukovec
Copy link
Contributor

oleg-jukovec commented May 8, 2024

The original pull request introduces table and ttable output formats for the tt console:
#535

The pull request introduces format for standalone tuples:
tarantool/tarantool#8549

@oleg-jukovec
Copy link
Contributor

oleg-jukovec commented May 14, 2024

Blocked by: tarantool/tarantool#10005

We discussed the issue with @sergepetrenko and decided to implement the feature by our team. It does not look like a big deal (but it may take time for RFC/approve/etc).

@oleg-jukovec
Copy link
Contributor

oleg-jukovec commented May 14, 2024

The idea is here to implement console.eval analogue in the file:
https://github.com/tarantool/tt/blob/master/cli/connect/lua/console_eval_func_body.lua
We already have something like that in:
https://github.com/tarantool/tt/blob/master/cli/connect/lua/eval_func_body.lua

And call it instead. The difference will be after the line:
https://github.com/tarantool/tarantool/blob/b32b20c6640bb0b1a6ca278bad8061529d46b5b0/src/box/lua/console.lua#L428

Here we need to transform raw lua-tuples and form a table with a metadata(format) in the SQL manner:

> box.execute([[SELECT * FROM SEQSCAN TABLE1;]])
---
- metadata:
  - name: COLUMN1
    type: integer
  - name: COLUMN2
    type: string
  rows:
  - [10, 'Hello SQL world!']
  - [20, 'Hello LUA world!']
...

It could although require an additional flag to notify the tt that the source data is a raw lua tuples. It will help to output into Lua/YAML as before:

- metadata:
  - name: COLUMN1
    type: integer
  - name: COLUMN2
    type: string
  lua: true
  rows:
  - [10, 'Hello SQL world!']
  - [20, 'Hello LUA world!']

As result, we will able to print the data in table/ttable/Lua/yaml format on the tt side.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants