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

CLI : Size column width based on data #4457

Open
rmoff opened this issue Feb 6, 2020 · 3 comments
Open

CLI : Size column width based on data #4457

rmoff opened this issue Feb 6, 2020 · 3 comments

Comments

@rmoff
Copy link
Contributor

rmoff commented Feb 6, 2020

It would help with usability if the CLI formatted the width of columns automatically based on the data in them.

Here's MySQL:

mysql> SELECT ID, FIRST_NAME, LAST_NAME, EMAIL, CLUB_STATUS FROM CUSTOMERS limit 5;
+----+-------------+------------+------------------------+-------------+
| ID | FIRST_NAME  | LAST_NAME  | EMAIL                  | CLUB_STATUS |
+----+-------------+------------+------------------------+-------------+
|  1 | Rica        | Blaisdell  | rblaisdell0@rambler.ru | bronze      |
|  2 | Ruthie      | Brockherst | rbrockherst1@ow.ly     | platinum    |
|  3 | Mariejeanne | Cocci      | mcocci2@techcrunch.com | bronze      |
|  4 | Hashim      | Rumke      | hrumke3@sohu.com       | platinum    |
|  5 | Hansiain    | Coda       | hcoda4@senate.gov      | platinum    |
+----+-------------+------------+------------------------+-------------+
5 rows in set (0.00 sec)

mysql>

Here's ksqlDB with the same data:

ksql> SELECT ID, FIRST_NAME, LAST_NAME, EMAIL, CLUB_STATUS FROM CUSTOMERS EMIT CHANGES LIMIT 5;
>
+--------------------------+--------------------------+--------------------------+--------------------------+--------------------------+
|ID                        |FIRST_NAME                |LAST_NAME                 |EMAIL                     |CLUB_STATUS               |
+--------------------------+--------------------------+--------------------------+--------------------------+--------------------------+
|1                         |Rica                      |Blaisdell                 |rblaisdell0@rambler.ru    |bronze                    |
|2                         |Ruthie                    |Brockherst                |rbrockherst1@ow.ly        |platinum                  |
|3                         |Mariejeanne               |Cocci                     |mcocci2@techcrunch.com    |bronze                    |
|4                         |Hashim                    |Rumke                     |hrumke3@sohu.com          |platinum                  |
|5                         |Hansiain                  |Coda                      |hcoda4@senate.gov         |platinum                  |
Limit Reached
Query terminated
ksql>
@agavra
Copy link
Contributor

agavra commented Feb 6, 2020

@rmoff - this is not really possible because we don't have the data upfront. With MySQL, they know the max width of the column before they print it, ksqlDB doesn't have that knowledge. I'm open to suggestions though

@rmoff
Copy link
Contributor Author

rmoff commented Feb 6, 2020

How about just buffer the first before rendering, and use that for sizing?
Having to then potentially wrap future columns would be better IMO than the current uniform-width approach. And make it a config so people can choose :)

@vpapavas vpapavas added this to the 0.8.0 milestone Feb 12, 2020
@vcrfxia vcrfxia modified the milestones: 0.8.0, 0.9.0 Mar 18, 2020
@colinhicks colinhicks removed this from the 0.9.0 milestone Mar 23, 2020
@hoey94
Copy link

hoey94 commented Mar 17, 2023

I have encountered a similar issue as well. Due to the large number of columns being queried, the data format displayed becomes messy.

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

6 participants