sql2csv

Type:command
Package:prepDATA/1.1 — Conversion, Transformation and Plotting of Basic Data Files
Namespace:&type1

Description

Execute an SQL query on a database and output the result to a CSV file.

Usage

sql2csv {options}
Bash equivalent: sql2csv {options}
usage: sql2csv [-h] [-v] [-l] [-V] [–db CONNECTION_STRING] [–query QUERY]
[-e ENCODING] [-H]
[FILE]
.
Execute an SQL query on a database and output the result to a CSV file.
.
positional arguments:
FILE The file to use as SQL query. If both FILE and QUERY
are omitted, query will be read from STDIN.
.
optional arguments:
-h, –help show this help message and exit
-v, –verbose Print detailed tracebacks when errors occur.
-l, –linenumbers Insert a column of line numbers at the front of the
output. Useful when piping to grep or as a simple
primary key.
-V, –version Display version information and exit.
–db CONNECTION_STRING
An sqlalchemy connection string to connect to a
database.
–query QUERY The SQL query to execute. If specified, it overrides
FILE and STDIN.
-e ENCODING, –encoding ENCODING
Specify the encoding of the input query file.
-H, –no-header-row Do not output column names.