https://github.com/morikuni/mdq
mdq queries multiple databases in parallel and output the results in JSON.
https://github.com/morikuni/mdq
cli database go mysql postgresql sql
Last synced: 3 months ago
JSON representation
mdq queries multiple databases in parallel and output the results in JSON.
- Host: GitHub
- URL: https://github.com/morikuni/mdq
- Owner: morikuni
- License: mit
- Created: 2016-11-26T14:45:40.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-14T14:48:03.000Z (about 9 years ago)
- Last Synced: 2024-11-15T10:57:55.415Z (over 1 year ago)
- Topics: cli, database, go, mysql, postgresql, sql
- Language: Go
- Homepage:
- Size: 29.3 KB
- Stars: 8
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mdq
[](https://travis-ci.org/morikuni/mdq)
mdq queries multiple databases in parallel and output the results in JSON.
## Example
```sh
$ mysql -u root --database example -e "select * from hello";
+------+---------+
| id | message |
+------+---------+
| 1 | hello |
| 2 | world |
+------+---------+
$ cat ~/.config/mdq/config.yaml
dbs:
- name: "example_db"
driver: "mysql"
dsn: "root@/example"
tags: ["example_tag"]
$ mdq --tag example_tag "select * from hello" | jq .
[
{
"Database": "example_db",
"Columns": [
"id",
"message"
],
"Rows": [
{
"id": "1",
"message": "hello"
},
{
"id": "2",
"message": "world"
}
]
}
]
```
## Supported Databases and DSN
- MySQL
- `[username[:password]@][protocol[(address)]]/dbname[?param1=value1&...¶mN=valueN]`
- [github.com/go-sql-driver/mysql](https://github.com/go-sql-driver/mysql#dsn-data-source-name)
- PostgreSQL
- `host=host dbname=dbname user=user password=password ssl=require`
- [github.com/lib/pq](https://godoc.org/github.com/lib/pq#hdr-Connection_String_Parameters)