Skip to content
/ mdq Public

mdq queries multiple databases in parallel and output the results in JSON.

License

Notifications You must be signed in to change notification settings

morikuni/mdq

Repository files navigation

mdq

Build Status

mdq queries multiple databases in parallel and output the results in JSON.

Example

$ 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