antares-sql / antares

A modern, fast and productivity driven SQL client with a focus in UX
https://antares-sql.app
MIT License
1.76k stars 120 forks source link

Accept MySQL alternate query terminators and output presentation format #489

Open bart-schaefer opened 1 year ago

bart-schaefer commented 1 year ago

Columns in some of our tables contain formatted text. It's difficult to work with this when displayed in a horizontal grid row. It is also sometimes useful to view SHOW CREATE TABLE output (rather than DESCRIBE), which is also unwieldy in a grid display.

MySQL client supports alternate query terminator \G to specify vertical display of labeled columns. Example:

db> select * from truth_category_response limit 1\G 1. row contact_id: 447584192 category_name: any recency: 2022-11-20 14:53:50 computable: yes report_time: 2022-11-21 10:30:23 1 row in set (0.03 sec)

db> show create table truth_category_response\G 1. row Table: truth_category_response Create Table: CREATE TABLE truth_category_response ( contact_id int(10) unsigned NOT NULL DEFAULT '0', category_name varchar(255) NOT NULL DEFAULT 'any', recency datetime NOT NULL DEFAULT '0000-00-00 00:00:00', computable enum('yes','no') DEFAULT 'yes', report_time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (contact_id,category_name), KEY recency (recency,computable) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 1 row in set (0.02 sec)

Currently I run the query with ; (or with no terminator if it's the only query in the editor) and then copy-paste from a column into the query editor or the scratchpad in order to see the full value including line breaks.

MySQL client also supports \g (lowercase) as equivalent to ;, it would be nice if that did not produce a syntax error.

Fabio286 commented 1 year ago

Hi @bart-schaefer,

Unfortunately, the CLI terminator \G is not supported by the drivers in use by Antares, and I am also not aware that it is usable with other GUI clients.

I understand your need to be able to display optimally formatted text. I may consider implementing a shortcut to display the contents of text cells in a window where they retain formatting, similar to what happens when double-clicking on a field of type TEXT.