SQL IMUX runs the same query across multiple servers and combines the results.
go install github.com/samlitowitz/sqlimux/cmd/sqlimux@latest
sqlimux sql-file-to-execute.sql --targets targets.jsonExample output on standard out with includeTargetID enabled.
targetID,integer_col
sqlite2,
sqlite2,1
sqlite1,
sqlite1,1
postgres,
postgres,2
mysql,
mysql,4
The targets file follows the JSON Schema defined in assets/schema/targets.json.
Here is an example.
{
"includeTargetID": true,
"targets": [
{
"targetID": "postgres",
"type": "postgres",
"dsn": "postgres://user:password@127.0.0.1:5432/user"
},
{
"targetID": "mysql",
"type": "mysql",
"dsn": "user:password@tcp(127.0.0.1:3306)/public?multiStatements=true"
},
{
"targetID": "sqlite1",
"type": "sqlite",
"dsn": "file:test_1.db"
},
{
"targetID": "sqlite2",
"type": "sqlite",
"dsn": "file:test_2.db"
}
]
}The following databases are currently supported
- MySQL
- Postgres
- SQLite