其他
给usql添加DuckDB支持
Why DuckDB系列:
usql
$usql
Type "help" for help.
(not connected)=> \drivers
Available Drivers:
cockroachdb (postgres) [cr, cdb, crdb, cockroach]
memsql (mysql) [me]
mssql [ms, sqlserver]
mysql [my, maria, aurora, mariadb, percona]
postgres [pg, pgsql, postgresql]
redshift (postgres) [rs]
sqlite3 [sq, file, sqlite]
tidb (mysql) [ti]
vitess (mysql) [vt]
(not connected)=>
usql[1]是一款通用的支持多种数据库的命令行客户端(类似于图形版的数据库客户端,如DBeaver),使用Go语言开发,支持30多种数据库,
Database (scheme/driver) | Protocol Aliases [real driver] |
---|---|
Microsoft SQL Server (mssql) | ms, sqlserver |
MySQL (mysql) | my, mariadb, maria, percona, aurora |
Oracle Database (godror) | or, oracle, oci8, oci, odpi, odpi-c |
PostgreSQL (postgres) | pg, postgresql, pgsql |
SQLite3 (sqlite3) | sq, sqlite, file |
Amazon Redshift (redshift) | rs [postgres] |
CockroachDB (cockroachdb) | cr, cockroach, crdb, cdb [postgres] |
MemSQL (memsql) | me [mysql] |
TiDB (tidb) | ti [mysql] |
Vitess (vitess) | vt [mysql] |
Google Spanner (spanner) | gs, google, span (not yet public) |
MySQL (mymysql) | zm, mymy |
PostgreSQL (pgx) | px |
Apache Avatica (avatica) | av, phoenix |
Apache Ignite (ignite) | ig, gridgain |
Cassandra (cql) | ca, cassandra, datastax, scy, scylla |
ClickHouse (clickhouse) | ch |
Couchbase (n1ql) | n1, couchbase |
Cznic QL (ql) | ql, cznic, cznicql |
Firebird SQL (firebirdsql) | fb, firebird |
Microsoft ADODB (adodb) | ad, ado |
ModernC SQLite (moderncsqlite) | mq, modernsqlite |
ODBC (odbc) | od |
OLE ODBC (oleodbc) | oo, ole, oleodbc [adodb] |
Presto (presto) | pr, prestodb, prestos, prs, prestodbs |
SAP ASE (tds) | ax, ase, sapase |
SAP HANA (hdb) | sa, saphana, sap, hana |
Snowflake (snowflake) | sf |
Vertica (vertica) | ve |
VoltDB (voltdb) | vo, volt, vdb |
多种常见数据库只需要一个免安装程序,非常方便使用。
usql添加DuckDB的支持
为了给usql添加DuckDB的支持,需要用到以下库,
go-duckdb[2] database/sql的DuckDB数据库引擎实现
alitrack/duckdb[3] libduckdb_static.a 添加parquet_extension支持
xo/usql[4] 添加DuckDB支持代码
xo/dburl[5] 添加DuckDB dburl(我只是做尝试,所以暂时省略了这一步)
代码继续完善中, 有兴趣的可以看看,https://github.com/alitrack/usql
链接
[1] https://github.com/xo/usql
[2] https://github.com/marcboeker/go-duckdb
[3] https://github.com/alitrack/duckdb
[4] https://github.com/alitrack/usql
[5] https://github.com/xo/dburl