Crates.io | odbc-tools |
lib.rs | odbc-tools |
version | 1.1.1 |
source | src |
created_at | 2019-07-02 15:11:17.103821 |
updated_at | 2020-02-12 17:22:11.582503 |
description | Command line interface tools to query databases with via native ODBC drivers |
homepage | |
repository | https://github.com/jpastuszek/odbc-tools |
max_upload_size | |
id | 145424 |
size | 52,387 |
Command line interface tools to query databases with via native ODBC drivers using 'odbc-iter' and 'odbc' Rust crates.
This package is published on crates.io.
cargo install odbc-tools
Run query and print result set with given formatting.
odbc-query $CONNECTION_STRING vertical "select * from sys.tables limit 2"
Example output:
0 id 2001
0 name schemas
0 schema_id 2000
0 query NULL
0 type 10
0 system true
0 commit_action 0
0 access 0
0 temporary 0
1 id 2007
1 name types
1 schema_id 2000
1 query NULL
1 type 10
1 system true
1 commit_action 0
1 access 0
1 temporary 0
odbc-query $CONNECTION_STRING json-array "select * from sys.tables limit 2"
Example output:
[2001,"schemas",2000,null,10,true,0,0,0]
[2007,"types",2000,null,10,true,0,0,0]
List installed ODBC drivers.
odbc-drivers
Example output:
DriverInfo { description: "Cloudera ODBC Driver for Apache Hive", attributes: {"Driver": "/opt/cloudera/hiveodbc/lib/universal/libclouderahiveodbc.dylib", "Description": "Cloudera ODBC Driver for Apache Hive"} }
DriverInfo { description: "MonetDB", attributes: {"Driver": "/usr/local/Cellar/monetdb/11.31.13/lib/libMonetODBC.so", "Description": "MonetDB Driver", "Setup": "/usr/local/Cellar/monetdb/11.31.13/lib/libMonetODBCs.so"} }
DriverInfo { description: "FreeTDS", attributes: {"Driver": "/usr/local/lib/libtdsodbc.so", "UsageCount": "2", "Description": "FreeTDS unixODBC Driver"} }
DriverInfo { description: "SQL Server", attributes: {"UsageCount": "1", "Description": "FreeTDS unixODBC Driver", "Driver": "/usr/local/lib/libtdsodbc.so"} }
Run SQL script from standard input.
echo "select * from sys.tables limit 2; select 1 as foo;" | odbc-script $CONNECTION_STRING
Example output:
0 0 id 2001
0 0 name schemas
0 0 schema_id 2000
0 0 query NULL
0 0 type 10
0 0 system true
0 0 commit_action 0
0 0 access 0
0 0 temporary 0
0 1 id 2007
0 1 name types
0 1 schema_id 2000
0 1 query NULL
0 1 type 10
0 1 system true
0 1 commit_action 0
0 1 access 0
0 1 temporary 0
1 0 foo 1