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 QUERYare 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 theoutput. Useful when piping to grep or as a simpleprimary key.-V, –version Display version information and exit.–db CONNECTION_STRINGAn sqlalchemy connection string to connect to adatabase.–query QUERY The SQL query to execute. If specified, it overridesFILE and STDIN.-e ENCODING, –encoding ENCODINGSpecify the encoding of the input query file.-H, –no-header-row Do not output column names.
-