gadwall is a pure Python based command line to duckdb.
It is forked from gadwall, which is available on PyPi - this project is not listed there.
This fork is mainly amended in three ways:
- the output is somewhat tabular
- it can dump its results to an HTML file
- "special" commands, which are not immedialtely passed to duckdb, are prefixed "."
gadwall can: | gadwall can not: |
---|---|
connect to an existing, file based duckdb database | use an in-memory-database |
run queries against that database | be installed from PyPi / using pip |
create an HTML output of the query results | create a database |
show explain plans nicely | show explain plans flawless in HTML output |
deal with every datatype supported by duckdb (try explicitely casting the results to varchar if you have issues; this is basically no limitation of gadwall but of the Python API of duckdb) | |
deal with every error from duckdb | |
run scripts |
image from wikimedia
C:\temp>python gadwall.py sample.db
Welcome to the gadwall, a duckdb shell. Type help or ? to list commands.
duckdb> .html duckdb.html
writing following commands to: "duckdb.html"
duckdb> .db
database: sample.db
duckdb> .schema
+--------+
|name |
+--------+
|weekdays|
+--------+
duckdb> .schema weekdays
+---+--------+-------+-------+----------+-----+
|cid|name |type |notnull|dflt_value|pk |
+---+--------+-------+-------+----------+-----+
| 0|no |INTEGER|False |(NULL) |False|
| 1|language|VARCHAR|False |(NULL) |False|
| 2|label |VARCHAR|False |(NULL) |False|
+---+--------+-------+-------+----------+-----+
duckdb> select * from weekdays
+--+--------+----------+
|no|language|label |
+--+--------+----------+
| 0|en |Monday |
| 1|en |Tuesday |
| 2|en |Wednesday |
| 3|en |Thursday |
| 4|en |Friday |
| 5|en |Saturday |
| 6|en |Sunday |
| 0|de |Montag |
| 1|de |Dienstag |
| 2|de |Mittwoch |
| 3|de |Donnerstag|
| 4|de |Freitag |
| 5|de |Samstag |
| 6|de |Sonntag |
+--+--------+----------+
duckdb> .html off
html file "duckdb.html" closed
duckdb> quit