Skip to content

Commit 8d185d4

Browse files
committed
Ran cog
1 parent a055f44 commit 8d185d4

File tree

1 file changed

+98
-62
lines changed

1 file changed

+98
-62
lines changed

docs/cli-reference.rst

Lines changed: 98 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ See :ref:`cli_query`.
131131
-r, --raw Raw output, first column of first row
132132
--raw-lines Raw output, first column of each row
133133
-p, --param <TEXT TEXT>... Named :parameters for SQL query
134-
--functions TEXT Python code defining one or more custom SQL
134+
--functions TEXT Python code or file path defining custom SQL
135135
functions
136136
--load-extension TEXT Path to SQLite extension, with optional
137137
:entrypoint
@@ -174,7 +174,7 @@ See :ref:`cli_memory`.
174174
sqlite-utils memory animals.csv --schema
175175

176176
Options:
177-
--functions TEXT Python code defining one or more custom SQL
177+
--functions TEXT Python code or file path defining custom SQL
178178
functions
179179
--attach <TEXT FILE>... Additional databases to attach - specify alias and
180180
filepath
@@ -270,6 +270,7 @@ See :ref:`cli_inserting_data`, :ref:`cli_insert_csv_tsv`, :ref:`cli_insert_unstr
270270
--nl Expect newline-delimited JSON
271271
-c, --csv Expect CSV input
272272
--tsv Expect TSV input
273+
--empty-null Treat empty strings as NULL
273274
--lines Treat each line as a single value called 'line'
274275
--text Treat input as a single value called 'text'
275276
--convert TEXT Python code to convert each item
@@ -280,13 +281,16 @@ See :ref:`cli_inserting_data`, :ref:`cli_insert_csv_tsv`, :ref:`cli_insert_unstr
280281
--no-headers CSV file has no header row
281282
--encoding TEXT Character encoding for input, defaults to utf-8
282283
--batch-size INTEGER Commit every X records
284+
--stop-after INTEGER Stop after X records
283285
--alter Alter existing table to add any missing columns
284286
--not-null TEXT Columns that should be created as NOT NULL
285287
--default <TEXT TEXT>... Default value that should be set for a column
286-
-d, --detect-types Detect types for columns in CSV/TSV data
288+
-d, --detect-types Detect types for columns in CSV/TSV data (default)
289+
--no-detect-types Treat all CSV/TSV columns as TEXT
287290
--analyze Run ANALYZE at the end of this operation
288291
--load-extension TEXT Path to SQLite extension, with optional :entrypoint
289292
--silent Do not show progress bar
293+
--strict Apply STRICT mode to created table
290294
--ignore Ignore records if pk already exists
291295
--replace Replace records if pk already exists
292296
--truncate Truncate table before inserting records, if table
@@ -324,6 +328,7 @@ See :ref:`cli_upsert`.
324328
--nl Expect newline-delimited JSON
325329
-c, --csv Expect CSV input
326330
--tsv Expect TSV input
331+
--empty-null Treat empty strings as NULL
327332
--lines Treat each line as a single value called 'line'
328333
--text Treat input as a single value called 'text'
329334
--convert TEXT Python code to convert each item
@@ -334,13 +339,16 @@ See :ref:`cli_upsert`.
334339
--no-headers CSV file has no header row
335340
--encoding TEXT Character encoding for input, defaults to utf-8
336341
--batch-size INTEGER Commit every X records
342+
--stop-after INTEGER Stop after X records
337343
--alter Alter existing table to add any missing columns
338344
--not-null TEXT Columns that should be created as NOT NULL
339345
--default <TEXT TEXT>... Default value that should be set for a column
340-
-d, --detect-types Detect types for columns in CSV/TSV data
346+
-d, --detect-types Detect types for columns in CSV/TSV data (default)
347+
--no-detect-types Treat all CSV/TSV columns as TEXT
341348
--analyze Run ANALYZE at the end of this operation
342349
--load-extension TEXT Path to SQLite extension, with optional :entrypoint
343350
--silent Do not show progress bar
351+
--strict Apply STRICT mode to created table
344352
-h, --help Show this message and exit.
345353

346354

@@ -368,12 +376,13 @@ See :ref:`cli_bulk`.
368376

369377
Options:
370378
--batch-size INTEGER Commit every X records
371-
--functions TEXT Python code defining one or more custom SQL functions
379+
--functions TEXT Python code or file path defining custom SQL functions
372380
--flatten Flatten nested JSON objects, so {"a": {"b": 1}} becomes
373381
{"a_b": 1}
374382
--nl Expect newline-delimited JSON
375383
-c, --csv Expect CSV input
376384
--tsv Expect TSV input
385+
--empty-null Treat empty strings as NULL
377386
--lines Treat each line as a single value called 'line'
378387
--text Treat input as a single value called 'text'
379388
--convert TEXT Python code to convert each item
@@ -450,20 +459,25 @@ See :ref:`cli_transform_table`.
450459
--rename column2 column_renamed
451460

452461
Options:
453-
--type <TEXT CHOICE>... Change column type to INTEGER, TEXT, FLOAT or BLOB
454-
--drop TEXT Drop this column
455-
--rename <TEXT TEXT>... Rename this column to X
456-
-o, --column-order TEXT Reorder columns
457-
--not-null TEXT Set this column to NOT NULL
458-
--not-null-false TEXT Remove NOT NULL from this column
459-
--pk TEXT Make this column the primary key
460-
--pk-none Remove primary key (convert to rowid table)
461-
--default <TEXT TEXT>... Set default value for this column
462-
--default-none TEXT Remove default from this column
463-
--drop-foreign-key TEXT Drop foreign key constraint for this column
464-
--sql Output SQL without executing it
465-
--load-extension TEXT Path to SQLite extension, with optional :entrypoint
466-
-h, --help Show this message and exit.
462+
--type <TEXT CHOICE>... Change column type to INTEGER, TEXT, FLOAT,
463+
REAL or BLOB
464+
--drop TEXT Drop this column
465+
--rename <TEXT TEXT>... Rename this column to X
466+
-o, --column-order TEXT Reorder columns
467+
--not-null TEXT Set this column to NOT NULL
468+
--not-null-false TEXT Remove NOT NULL from this column
469+
--pk TEXT Make this column the primary key
470+
--pk-none Remove primary key (convert to rowid table)
471+
--default <TEXT TEXT>... Set default value for this column
472+
--default-none TEXT Remove default from this column
473+
--add-foreign-key <TEXT TEXT TEXT>...
474+
Add a foreign key constraint from a column to
475+
another table with another column
476+
--drop-foreign-key TEXT Drop foreign key constraint for this column
477+
--sql Output SQL without executing it
478+
--load-extension TEXT Path to SQLite extension, with optional
479+
:entrypoint
480+
-h, --help Show this message and exit.
467481

468482

469483
.. _cli_ref_extract:
@@ -591,42 +605,45 @@ See :ref:`cli_convert`.
591605

592606
Convert columns using Python code you supply. For example:
593607

594-
sqlite-utils convert my.db mytable mycolumn \
595-
'"\n".join(textwrap.wrap(value, 10))' \
596-
--import=textwrap
608+
sqlite-utils convert my.db mytable mycolumn \
609+
'"\n".join(textwrap.wrap(value, 10))' \
610+
--import=textwrap
597611

598612
"value" is a variable with the column value to be converted.
599613

600614
Use "-" for CODE to read Python code from standard input.
601615

602616
The following common operations are available as recipe functions:
603617

604-
r.jsonsplit(value, delimiter=',', type=<class 'str'>)
618+
r.jsonsplit(value: 'str', delimiter: 'str' = ',', type: 'Callable[[str],
619+
object]' = <class 'str'>) -> 'str'
605620

606-
Convert a string like a,b,c into a JSON array ["a", "b", "c"]
621+
Convert a string like a,b,c into a JSON array ["a", "b", "c"]
607622

608-
r.parsedate(value, dayfirst=False, yearfirst=False, errors=None)
623+
r.parsedate(value: 'str', dayfirst: 'bool' = False, yearfirst: 'bool' = False,
624+
errors: 'Optional[object]' = None) -> 'Optional[str]'
609625

610-
Parse a date and convert it to ISO date format: yyyy-mm-dd
611-
612-
- dayfirst=True: treat xx as the day in xx/yy/zz
613-
- yearfirst=True: treat xx as the year in xx/yy/zz
614-
- errors=r.IGNORE to ignore values that cannot be parsed
615-
- errors=r.SET_NULL to set values that cannot be parsed to null
626+
Parse a date and convert it to ISO date format: yyyy-mm-dd
627+
628+
- dayfirst=True: treat xx as the day in xx/yy/zz
629+
- yearfirst=True: treat xx as the year in xx/yy/zz
630+
- errors=r.IGNORE to ignore values that cannot be parsed
631+
- errors=r.SET_NULL to set values that cannot be parsed to null
616632

617-
r.parsedatetime(value, dayfirst=False, yearfirst=False, errors=None)
633+
r.parsedatetime(value: 'str', dayfirst: 'bool' = False, yearfirst: 'bool' =
634+
False, errors: 'Optional[object]' = None) -> 'Optional[str]'
618635

619-
Parse a datetime and convert it to ISO datetime format: yyyy-mm-ddTHH:MM:SS
620-
621-
- dayfirst=True: treat xx as the day in xx/yy/zz
622-
- yearfirst=True: treat xx as the year in xx/yy/zz
623-
- errors=r.IGNORE to ignore values that cannot be parsed
624-
- errors=r.SET_NULL to set values that cannot be parsed to null
636+
Parse a datetime and convert it to ISO datetime format: yyyy-mm-ddTHH:MM:SS
637+
638+
- dayfirst=True: treat xx as the day in xx/yy/zz
639+
- yearfirst=True: treat xx as the year in xx/yy/zz
640+
- errors=r.IGNORE to ignore values that cannot be parsed
641+
- errors=r.SET_NULL to set values that cannot be parsed to null
625642

626643
You can use these recipes like so:
627644

628-
sqlite-utils convert my.db mytable mycolumn \
629-
'r.jsonsplit(value, delimiter=":")'
645+
sqlite-utils convert my.db mytable mycolumn \
646+
'r.jsonsplit(value, delimiter=":")'
630647

631648
Options:
632649
--import TEXT Python modules to import
@@ -641,8 +658,8 @@ See :ref:`cli_convert`.
641658
--output-type [integer|float|blob|text]
642659
Column type to use for the output column
643660
--drop Drop original column afterwards
644-
--no-skip-false Don't skip falsey values
645661
-s, --silent Don't show a progress bar
662+
--pdb Open pdb debugger on first error
646663
-h, --help Show this message and exit.
647664

648665

@@ -909,6 +926,7 @@ See :ref:`cli_create_table`.
909926
--replace If table already exists, replace it
910927
--transform If table already exists, try to transform the schema
911928
--load-extension TEXT Path to SQLite extension, with optional :entrypoint
929+
--strict Apply STRICT mode to created table
912930
-h, --help Show this message and exit.
913931

914932

@@ -1030,21 +1048,6 @@ disable-fts
10301048
-h, --help Show this message and exit.
10311049

10321050

1033-
.. _cli_ref_tui:
1034-
1035-
tui
1036-
===
1037-
1038-
::
1039-
1040-
Usage: sqlite-utils tui [OPTIONS]
1041-
1042-
Open Textual TUI.
1043-
1044-
Options:
1045-
-h, --help Show this message and exit.
1046-
1047-
10481051
.. _cli_ref_optimize:
10491052

10501053
optimize
@@ -1144,7 +1147,7 @@ See :ref:`cli_add_column`.
11441147
::
11451148

11461149
Usage: sqlite-utils add-column [OPTIONS] PATH TABLE COL_NAME
1147-
[[integer|float|blob|text|INTEGER|FLOAT|BLOB|TEXT]]
1150+
[[integer|int|float|real|text|str|blob|bytes]]
11481151

11491152
Add a column to the specified table
11501153

@@ -1180,8 +1183,6 @@ See :ref:`cli_add_foreign_key`.
11801183

11811184
sqlite-utils add-foreign-key my.db books author_id authors id
11821185

1183-
WARNING: Could corrupt your database! Back up your database file first.
1184-
11851186
Options:
11861187
--ignore If foreign key already exists, do nothing
11871188
--load-extension TEXT Path to SQLite extension, with optional :entrypoint
@@ -1337,6 +1338,25 @@ See :ref:`cli_duplicate_table`.
13371338
-h, --help Show this message and exit.
13381339

13391340

1341+
.. _cli_ref_rename_table:
1342+
1343+
rename-table
1344+
============
1345+
1346+
See :ref:`cli_renaming_tables`.
1347+
1348+
::
1349+
1350+
Usage: sqlite-utils rename-table [OPTIONS] PATH TABLE NEW_NAME
1351+
1352+
Rename this table.
1353+
1354+
Options:
1355+
--ignore If table does not exist, do nothing
1356+
--load-extension TEXT Path to SQLite extension, with optional :entrypoint
1357+
-h, --help Show this message and exit.
1358+
1359+
13401360
.. _cli_ref_drop_table:
13411361

13421362
drop-table
@@ -1417,13 +1437,14 @@ See :ref:`cli_install`.
14171437

14181438
::
14191439

1420-
Usage: sqlite-utils install [OPTIONS] PACKAGES...
1440+
Usage: sqlite-utils install [OPTIONS] [PACKAGES]...
14211441

14221442
Install packages from PyPI into the same environment as sqlite-utils
14231443

14241444
Options:
1425-
-U, --upgrade Upgrade packages to latest version
1426-
-h, --help Show this message and exit.
1445+
-U, --upgrade Upgrade packages to latest version
1446+
-e, --editable TEXT Install a project in editable mode from this path
1447+
-h, --help Show this message and exit.
14271448

14281449

14291450
.. _cli_ref_uninstall:
@@ -1498,4 +1519,19 @@ See :ref:`cli_spatialite_indexes`.
14981519
-h, --help Show this message and exit.
14991520

15001521

1522+
.. _cli_ref_plugins:
1523+
1524+
plugins
1525+
=======
1526+
1527+
::
1528+
1529+
Usage: sqlite-utils plugins [OPTIONS]
1530+
1531+
List installed plugins
1532+
1533+
Options:
1534+
-h, --help Show this message and exit.
1535+
1536+
15011537
.. [[[end]]]

0 commit comments

Comments
 (0)