Skip to content
New issue

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

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

Already on GitHub? # to your account

Feature Request: Streaming/Interactive mode #20

Open
jackyzhen opened this issue Oct 26, 2018 · 0 comments
Open

Feature Request: Streaming/Interactive mode #20

jackyzhen opened this issue Oct 26, 2018 · 0 comments

Comments

@jackyzhen
Copy link
Contributor

jackyzhen commented Oct 26, 2018

Typing echo "some sql" | sql someDb can get tiring when you want to keep querying a specific database. It would be neat if sql can run in an interactive mode, e.g.:

sql db1 -i

select count(*) from Row

89181

show create table Holiday

Holiday	CREATE TABLE `Holiday` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`enName` varchar(254) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8

select * from Holiday

1	New Year's Day	NULL
2	Memorial Day	NULL
3	Independence Day	NULL
4	Labor Day	NULL
5	Columbus Day	NULL
6	Veterans Day	NULL
7	Thanksgiving Day	NULL
8	Christmas Day	NULL
9	New Year's Eve	NULL
10	Martin Luther King Jr. Day	NULL
11	Presidents' Day	NULL

exit

Basically running sql with -i will continuously read lines from STDIN and try to run them and print the output. The advantage is not having to echo, quote, pipe and name the db over and over. It would go towards making sql the defacto sql client for me

Advantages:

  1. It won't be a big change/extension.
  2. It'll basically replaces the use case of running the default mysql client. Its like a shortcut based on sql config.
  3. Doesn't change any existing functionality.
  4. Allows you to pipe a file with sql queries separated by new lines and sql will spit out the output
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant