mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-08-03 07:54:22 +02:00
--empty-null option for CSV and TSV imports, closes #563
This commit is contained in:
parent
63dc7ab1a5
commit
f7af23837d
5 changed files with 55 additions and 2 deletions
16
docs/cli.rst
16
docs/cli.rst
|
|
@ -1281,6 +1281,22 @@ You can set the ``SQLITE_UTILS_DETECT_TYPES`` environment variable if you want `
|
|||
|
||||
export SQLITE_UTILS_DETECT_TYPES=1
|
||||
|
||||
If a CSV or TSV file includes empty cells, like this one:
|
||||
|
||||
.. code-block:: csv
|
||||
|
||||
name,age,weight
|
||||
Cleo,6,
|
||||
Dori,,3.5
|
||||
|
||||
They will be imported into SQLite as empty string values, ``""``.
|
||||
|
||||
To import them as ``NULL`` values instead, use the ``--empty-null`` option:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
sqlite-utils insert creatures.db creatures creatures.csv --csv --empty-null
|
||||
|
||||
.. _cli_insert_csv_tsv_delimiter:
|
||||
|
||||
Alternative delimiters and quote characters
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue