Code Monkey home page Code Monkey logo

gadwall's Introduction

gadwall - Command Line Client to duckdb

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

Example Usage

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.