sqlite-utils insert/upsert --type colunm-name type option, closes #131

This commit is contained in:
Simon Willison 2026-07-07 19:17:29 -07:00
commit d2ac3765ed
5 changed files with 102 additions and 1 deletions

View file

@ -246,6 +246,9 @@ See :ref:`cli_inserting_data`, :ref:`cli_insert_csv_tsv`, :ref:`cli_insert_unstr
- Use --lines to write each incoming line to a column called "line"
- Use --text to write the entire input to a column called "text"
Use --type column-name type to override the type automatically chosen when the
table is created.
You can also use --convert to pass a fragment of Python code that will be used
to convert each input.
@ -306,6 +309,7 @@ See :ref:`cli_inserting_data`, :ref:`cli_insert_csv_tsv`, :ref:`cli_insert_unstr
--alter Alter existing table to add any missing columns
--not-null TEXT Columns that should be created as NOT NULL
--default <TEXT TEXT>... Default value that should be set for a column
--type <TEXT CHOICE>... Column types to use when creating the table
--no-detect-types Treat all CSV/TSV columns as TEXT
--analyze Run ANALYZE at the end of this operation
--load-extension TEXT Path to SQLite extension, with optional :entrypoint
@ -335,6 +339,9 @@ See :ref:`cli_upsert`.
If the table already exists and has a primary key, --pk can be omitted.
Use --type column-name type to override the type automatically chosen when the
table is created.
Example:
echo '[
@ -366,6 +373,7 @@ See :ref:`cli_upsert`.
--alter Alter existing table to add any missing columns
--not-null TEXT Columns that should be created as NOT NULL
--default <TEXT TEXT>... Default value that should be set for a column
--type <TEXT CHOICE>... Column types to use when creating the table
--no-detect-types Treat all CSV/TSV columns as TEXT
--analyze Run ANALYZE at the end of this operation
--load-extension TEXT Path to SQLite extension, with optional :entrypoint