Open
Description
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:
- It won't be a big change/extension.
- It'll basically replaces the use case of running the default mysql client. Its like a shortcut based on sql config.
- Doesn't change any existing functionality.
- Allows you to pipe a file with sql queries separated by new lines and sql will spit out the output
Metadata
Metadata
Assignees
Labels
No labels