sqlite-utils 4.0a0__tar.gz → 4.0rc1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. {sqlite_utils-4.0a0/sqlite_utils.egg-info → sqlite_utils-4.0rc1}/PKG-INFO +12 -45
  2. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/docs/changelog.rst +42 -1
  3. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/docs/cli-reference.rst +129 -81
  4. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/docs/cli.rst +203 -145
  5. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/docs/contributing.rst +18 -40
  6. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/docs/index.rst +1 -0
  7. sqlite_utils-4.0rc1/docs/migrations.rst +171 -0
  8. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/docs/python-api.rst +338 -241
  9. sqlite_utils-4.0rc1/pyproject.toml +84 -0
  10. sqlite_utils-4.0rc1/setup.cfg +4 -0
  11. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/sqlite_utils/__init__.py +2 -1
  12. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/sqlite_utils/cli.py +395 -125
  13. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/sqlite_utils/db.py +727 -451
  14. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/sqlite_utils/hookspecs.py +5 -2
  15. sqlite_utils-4.0rc1/sqlite_utils/migrations.py +126 -0
  16. sqlite_utils-4.0rc1/sqlite_utils/plugins.py +35 -0
  17. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/sqlite_utils/recipes.py +25 -5
  18. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/sqlite_utils/utils.py +165 -74
  19. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1/sqlite_utils.egg-info}/PKG-INFO +12 -45
  20. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/sqlite_utils.egg-info/SOURCES.txt +7 -3
  21. sqlite_utils-4.0rc1/sqlite_utils.egg-info/requires.txt +7 -0
  22. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/conftest.py +24 -5
  23. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_analyze_tables.py +3 -7
  24. sqlite_utils-4.0rc1/tests/test_atomic.py +174 -0
  25. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_cli.py +375 -185
  26. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_cli_bulk.py +26 -0
  27. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_cli_convert.py +60 -22
  28. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_cli_insert.py +35 -17
  29. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_cli_memory.py +52 -17
  30. sqlite_utils-4.0rc1/tests/test_cli_migrate.py +303 -0
  31. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_convert.py +3 -2
  32. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_create.py +184 -70
  33. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_default_value.py +0 -1
  34. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_docs.py +4 -4
  35. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_duplicate.py +6 -8
  36. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_enable_counts.py +11 -11
  37. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_extract.py +23 -28
  38. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_extracts.py +3 -3
  39. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_fts.py +90 -67
  40. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_gis.py +2 -2
  41. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_introspect.py +20 -16
  42. sqlite_utils-4.0rc1/tests/test_list_mode.py +288 -0
  43. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_lookup.py +12 -12
  44. sqlite_utils-4.0rc1/tests/test_migrations.py +110 -0
  45. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_plugins.py +34 -1
  46. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_recipes.py +24 -13
  47. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_recreate.py +5 -2
  48. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_register_function.py +37 -30
  49. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_rows_from_file.py +1 -1
  50. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_sniff.py +1 -1
  51. sqlite_utils-4.0rc1/tests/test_tracer.py +96 -0
  52. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_transform.py +74 -76
  53. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_update.py +4 -3
  54. sqlite_utils-4.0a0/setup.cfg +0 -8
  55. sqlite_utils-4.0a0/setup.py +0 -82
  56. sqlite_utils-4.0a0/sqlite_utils/plugins.py +0 -26
  57. sqlite_utils-4.0a0/sqlite_utils.egg-info/not-zip-safe +0 -1
  58. sqlite_utils-4.0a0/sqlite_utils.egg-info/requires.txt +0 -31
  59. sqlite_utils-4.0a0/tests/test_tracer.py +0 -99
  60. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/LICENSE +0 -0
  61. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/MANIFEST.in +0 -0
  62. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/README.md +0 -0
  63. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/docs/installation.rst +0 -0
  64. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/docs/plugins.rst +0 -0
  65. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/docs/reference.rst +0 -0
  66. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/sqlite_utils/__main__.py +0 -0
  67. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/sqlite_utils/py.typed +0 -0
  68. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/sqlite_utils.egg-info/dependency_links.txt +0 -0
  69. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/sqlite_utils.egg-info/entry_points.txt +0 -0
  70. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/sqlite_utils.egg-info/top_level.txt +0 -0
  71. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/__init__.py +0 -0
  72. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_analyze.py +0 -0
  73. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_attach.py +0 -0
  74. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_column_affinity.py +0 -0
  75. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_constructor.py +0 -0
  76. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_conversions.py +0 -0
  77. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_create_view.py +0 -0
  78. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_delete.py +0 -0
  79. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_get.py +0 -0
  80. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_hypothesis.py +0 -0
  81. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_insert_files.py +0 -0
  82. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_m2m.py +0 -0
  83. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_query.py +0 -0
  84. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_rows.py +0 -0
  85. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_suggest_column_types.py +0 -0
  86. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_upsert.py +0 -0
  87. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_utils.py +0 -0
  88. {sqlite_utils-4.0a0 → sqlite_utils-4.0rc1}/tests/test_wal.py +0 -0
@@ -1,68 +1,35 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlite-utils
3
- Version: 4.0a0
3
+ Version: 4.0rc1
4
4
  Summary: CLI tool and Python library for manipulating SQLite databases
5
- Home-page: https://github.com/simonw/sqlite-utils
6
5
  Author: Simon Willison
7
- License: Apache License, Version 2.0
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/simonw/sqlite-utils
8
8
  Project-URL: Documentation, https://sqlite-utils.datasette.io/en/stable/
9
9
  Project-URL: Changelog, https://sqlite-utils.datasette.io/en/stable/changelog.html
10
- Project-URL: Source code, https://github.com/simonw/sqlite-utils
11
10
  Project-URL: Issues, https://github.com/simonw/sqlite-utils/issues
12
11
  Project-URL: CI, https://github.com/simonw/sqlite-utils/actions
13
12
  Classifier: Development Status :: 5 - Production/Stable
14
13
  Classifier: Intended Audience :: Developers
15
- Classifier: Intended Audience :: Science/Research
16
14
  Classifier: Intended Audience :: End Users/Desktop
17
- Classifier: Topic :: Database
18
- Classifier: License :: OSI Approved :: Apache Software License
19
- Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Intended Audience :: Science/Research
20
16
  Classifier: Programming Language :: Python :: 3.10
21
17
  Classifier: Programming Language :: Python :: 3.11
22
18
  Classifier: Programming Language :: Python :: 3.12
23
19
  Classifier: Programming Language :: Python :: 3.13
24
- Requires-Python: >=3.9
20
+ Classifier: Programming Language :: Python :: 3.14
21
+ Classifier: Topic :: Database
22
+ Requires-Python: >=3.10
25
23
  Description-Content-Type: text/markdown
26
24
  License-File: LICENSE
27
- Requires-Dist: sqlite-fts4
28
- Requires-Dist: click
25
+ Requires-Dist: click>=8.3.1
29
26
  Requires-Dist: click-default-group>=1.2.3
30
- Requires-Dist: tabulate
31
- Requires-Dist: python-dateutil
32
27
  Requires-Dist: pluggy
33
- Provides-Extra: test
34
- Requires-Dist: pytest; extra == "test"
35
- Requires-Dist: black>=24.1.1; extra == "test"
36
- Requires-Dist: hypothesis; extra == "test"
37
- Requires-Dist: cogapp; extra == "test"
38
- Provides-Extra: docs
39
- Requires-Dist: furo; extra == "docs"
40
- Requires-Dist: sphinx-autobuild; extra == "docs"
41
- Requires-Dist: codespell; extra == "docs"
42
- Requires-Dist: sphinx-copybutton; extra == "docs"
43
- Requires-Dist: beanbag-docutils>=2.0; extra == "docs"
44
- Requires-Dist: pygments-csv-lexer; extra == "docs"
45
- Provides-Extra: mypy
46
- Requires-Dist: mypy; extra == "mypy"
47
- Requires-Dist: types-click; extra == "mypy"
48
- Requires-Dist: types-tabulate; extra == "mypy"
49
- Requires-Dist: types-python-dateutil; extra == "mypy"
50
- Requires-Dist: types-pluggy; extra == "mypy"
51
- Requires-Dist: data-science-types; extra == "mypy"
52
- Provides-Extra: flake8
53
- Requires-Dist: flake8; extra == "flake8"
54
- Dynamic: author
55
- Dynamic: classifier
56
- Dynamic: description
57
- Dynamic: description-content-type
58
- Dynamic: home-page
59
- Dynamic: license
28
+ Requires-Dist: python-dateutil
29
+ Requires-Dist: sqlite-fts4
30
+ Requires-Dist: tabulate
31
+ Requires-Dist: pip
60
32
  Dynamic: license-file
61
- Dynamic: project-url
62
- Dynamic: provides-extra
63
- Dynamic: requires-dist
64
- Dynamic: requires-python
65
- Dynamic: summary
66
33
 
67
34
  # sqlite-utils
68
35
 
@@ -4,6 +4,47 @@
4
4
  Changelog
5
5
  ===========
6
6
 
7
+ .. _v4_0rc1:
8
+
9
+ 4.0rc1 (2026-06-21)
10
+ -------------------
11
+
12
+ - New :ref:`database migrations system <migrations>`, incorporating functionality that was previously provided by the separate `sqlite-migrate <https://github.com/simonw/sqlite-migrate>`__ plugin. Define migration sets using the new :class:`sqlite_utils.Migrations` class and apply them using the ``sqlite-utils migrate`` command or the :ref:`migrations Python API <migrations_python>`. (:issue:`752`)
13
+ - New ``db.atomic()`` :ref:`context manager providing nested transaction support <python_api_atomic>` using SQLite transactions and savepoints. Internal multi-step operations such as ``table.transform()`` now use this mechanism to avoid unexpectedly committing an existing transaction. (:issue:`755`)
14
+ - ``Database`` objects can now be :ref:`used as context managers <python_api_close>`, automatically closing the connection when the ``with`` block exits. The CLI also now closes database and file handles more reliably, resolving a number of ``ResourceWarning`` warnings. (:issue:`692`)
15
+ - The ``sqlite-utils convert`` command can now accept a direct callable reference such as ``r.parsedate`` or ``json.loads --import json`` as the conversion code, as an alternative to calling it explicitly with ``r.parsedate(value)``. (:issue:`686`)
16
+ - Fixed a bug where CSV or TSV files with only a header row could crash ``sqlite-utils insert`` and ``sqlite-utils memory`` when type detection was enabled. Thanks, `Rami Abdelrazzaq <https://github.com/RamiNoodle733>`__. (:issue:`702`, `#707 <https://github.com/simonw/sqlite-utils/pull/707>`__)
17
+ - Fixed a bug where installed plugins could be loaded while running the test suite, despite the test-mode safeguard that disables plugin loading. Thanks, `Rami Abdelrazzaq <https://github.com/RamiNoodle733>`__. (:issue:`713`, `#719 <https://github.com/simonw/sqlite-utils/pull/719>`__)
18
+ - ``table.detect_fts()`` now recognizes legacy FTS virtual tables that quote the ``content=`` table name using square brackets, allowing ``table.enable_fts(..., replace=True)`` to replace them correctly. (:issue:`694`)
19
+ - Now depends on Click 8.3.1 or later, removing compatibility workarounds for Click's ``Sentinel`` default values. (:issue:`666`)
20
+ - Improved type annotations throughout the package, with ``ty`` now run in CI. (:issue:`697`)
21
+ - Development tooling now uses ``uv`` dependency groups, with separate ``dev`` and ``docs`` groups. (:issue:`691`)
22
+ - The test suite now runs against Python 3.15-dev. (:issue:`738`)
23
+
24
+ .. _v3_39:
25
+
26
+ 3.39 (2025-11-24)
27
+ -----------------
28
+
29
+ - Fixed a bug with ``sqlite-utils install`` when the tool had been installed using ``uv``. (:issue:`687`)
30
+ - The ``--functions`` argument now optionally accepts a path to a Python file as an alternative to a string full of code, and can be specified multiple times - see :ref:`cli_query_functions`. (:issue:`659`)
31
+ - ``sqlite-utils`` now requires Python 3.10 or higher.
32
+
33
+ .. _v4_0a1:
34
+
35
+ 4.0a1 (2025-11-23)
36
+ ------------------
37
+
38
+ - **Breaking change**: The ``db.table(table_name)`` method now only works with tables. To access a SQL view use ``db.view(view_name)`` instead. (:issue:`657`)
39
+ - The ``table.insert_all()`` and ``table.upsert_all()`` methods can now accept an iterator of lists or tuples as an alternative to dictionaries. The first item should be a list/tuple of column names. See :ref:`python_api_insert_lists` for details. (:issue:`672`)
40
+ - **Breaking change**: The default floating point column type has been changed from ``FLOAT`` to ``REAL``, which is the correct SQLite type for floating point values. This affects auto-detected columns when inserting data. (:issue:`645`)
41
+ - Now uses ``pyproject.toml`` in place of ``setup.py`` for packaging. (:issue:`675`)
42
+ - Tables in the Python API now do a much better job of remembering the primary key and other schema details from when they were first created. (:issue:`655`)
43
+ - **Breaking change**: The ``table.convert()`` and ``sqlite-utils convert`` mechanisms no longer skip values that evaluate to ``False``. Previously the ``--skip-false`` option was needed, this has been removed. (:issue:`542`)
44
+ - **Breaking change**: Tables created by this library now wrap table and column names in ``"double-quotes"`` in the schema. Previously they would use ``[square-braces]``. (:issue:`677`)
45
+ - The ``--functions`` CLI argument now accepts a path to a Python file in addition to accepting a string full of Python code. It can also now be specified multiple times. (:issue:`659`)
46
+ - **Breaking change:** Type detection is now the default behavior for the ``insert`` and ``upsert`` CLI commands when importing CSV or TSV data. Previously all columns were treated as ``TEXT`` unless the ``--detect-types`` flag was passed. Use the new ``--no-detect-types`` flag to restore the old behavior. The ``SQLITE_UTILS_DETECT_TYPES`` environment variable has been removed. (:issue:`679`)
47
+
7
48
  .. _v4_0a0:
8
49
 
9
50
  4.0a0 (2025-05-08)
@@ -158,7 +199,7 @@ This release introduces a new :ref:`plugin system <plugins>`. Read more about th
158
199
  - Conversion functions passed to :ref:`table.convert(...) <python_api_convert>` can now return lists or dictionaries, which will be inserted into the database as JSON strings. (:issue:`495`)
159
200
  - ``sqlite-utils install`` and ``sqlite-utils uninstall`` commands for installing packages into the same virtual environment as ``sqlite-utils``, :ref:`described here <cli_install>`. (:issue:`483`)
160
201
  - New :ref:`sqlite_utils.utils.flatten() <reference_utils_flatten>` utility function. (:issue:`500`)
161
- - Documentation on :ref:`using Just <contributing_just>` to run tests, linters and build documentation.
202
+ - Documentation on :ref:`using Just <contributing_just>` to run tests, linters and build documentation.
162
203
  - Documentation now covers the :ref:`release_process` for this package.
163
204
 
164
205
  .. _v3_29:
@@ -20,7 +20,7 @@ This page lists the ``--help`` for every ``sqlite-utils`` CLI sub-command.
20
20
  "query", "memory", "insert", "upsert", "bulk", "search", "transform", "extract",
21
21
  "schema", "insert-files", "analyze-tables", "convert", "tables", "views", "rows",
22
22
  "triggers", "indexes", "create-database", "create-table", "create-index",
23
- "enable-fts", "populate-fts", "rebuild-fts", "disable-fts"
23
+ "migrate", "enable-fts", "populate-fts", "rebuild-fts", "disable-fts"
24
24
  ]
25
25
  refs = {
26
26
  "query": "cli_query",
@@ -49,6 +49,7 @@ This page lists the ``--help`` for every ``sqlite-utils`` CLI sub-command.
49
49
  "enable-wal": "cli_wal",
50
50
  "enable-counts": "cli_enable_counts",
51
51
  "bulk": "cli_bulk",
52
+ "migrate": "cli_migrate",
52
53
  "create-database": "cli_create_database",
53
54
  "create-table": "cli_create_table",
54
55
  "drop-table": "cli_drop_table",
@@ -117,21 +118,21 @@ See :ref:`cli_query`.
117
118
  --tsv Output TSV
118
119
  --no-headers Omit CSV headers
119
120
  -t, --table Output as a formatted table
120
- --fmt TEXT Table format - one of asciidoc, double_grid,
121
- double_outline, fancy_grid, fancy_outline, github,
122
- grid, heavy_grid, heavy_outline, html, jira,
123
- latex, latex_booktabs, latex_longtable, latex_raw,
124
- mediawiki, mixed_grid, mixed_outline, moinmoin,
125
- orgtbl, outline, pipe, plain, presto, pretty,
126
- psql, rounded_grid, rounded_outline, rst, simple,
127
- simple_grid, simple_outline, textile, tsv,
128
- unsafehtml, youtrack
121
+ --fmt TEXT Table format - one of asciidoc, colon_grid,
122
+ double_grid, double_outline, fancy_grid,
123
+ fancy_outline, github, grid, heavy_grid,
124
+ heavy_outline, html, jira, latex, latex_booktabs,
125
+ latex_longtable, latex_raw, mediawiki, mixed_grid,
126
+ mixed_outline, moinmoin, orgtbl, outline, pipe,
127
+ plain, presto, pretty, psql, rounded_grid,
128
+ rounded_outline, rst, simple, simple_grid,
129
+ simple_outline, textile, tsv, unsafehtml, youtrack
129
130
  --json-cols Detect JSON cols and output them as JSON, not
130
131
  escaped strings
131
132
  -r, --raw Raw output, first column of first row
132
133
  --raw-lines Raw output, first column of each row
133
134
  -p, --param <TEXT TEXT>... Named :parameters for SQL query
134
- --functions TEXT Python code defining one or more custom SQL
135
+ --functions TEXT Python code or file path defining custom SQL
135
136
  functions
136
137
  --load-extension TEXT Path to SQLite extension, with optional
137
138
  :entrypoint
@@ -174,7 +175,7 @@ See :ref:`cli_memory`.
174
175
  sqlite-utils memory animals.csv --schema
175
176
 
176
177
  Options:
177
- --functions TEXT Python code defining one or more custom SQL
178
+ --functions TEXT Python code or file path defining custom SQL
178
179
  functions
179
180
  --attach <TEXT FILE>... Additional databases to attach - specify alias and
180
181
  filepath
@@ -186,15 +187,15 @@ See :ref:`cli_memory`.
186
187
  --tsv Output TSV
187
188
  --no-headers Omit CSV headers
188
189
  -t, --table Output as a formatted table
189
- --fmt TEXT Table format - one of asciidoc, double_grid,
190
- double_outline, fancy_grid, fancy_outline, github,
191
- grid, heavy_grid, heavy_outline, html, jira,
192
- latex, latex_booktabs, latex_longtable, latex_raw,
193
- mediawiki, mixed_grid, mixed_outline, moinmoin,
194
- orgtbl, outline, pipe, plain, presto, pretty,
195
- psql, rounded_grid, rounded_outline, rst, simple,
196
- simple_grid, simple_outline, textile, tsv,
197
- unsafehtml, youtrack
190
+ --fmt TEXT Table format - one of asciidoc, colon_grid,
191
+ double_grid, double_outline, fancy_grid,
192
+ fancy_outline, github, grid, heavy_grid,
193
+ heavy_outline, html, jira, latex, latex_booktabs,
194
+ latex_longtable, latex_raw, mediawiki, mixed_grid,
195
+ mixed_outline, moinmoin, orgtbl, outline, pipe,
196
+ plain, presto, pretty, psql, rounded_grid,
197
+ rounded_outline, rst, simple, simple_grid,
198
+ simple_outline, textile, tsv, unsafehtml, youtrack
198
199
  --json-cols Detect JSON cols and output them as JSON, not
199
200
  escaped strings
200
201
  -r, --raw Raw output, first column of first row
@@ -285,7 +286,8 @@ See :ref:`cli_inserting_data`, :ref:`cli_insert_csv_tsv`, :ref:`cli_insert_unstr
285
286
  --alter Alter existing table to add any missing columns
286
287
  --not-null TEXT Columns that should be created as NOT NULL
287
288
  --default <TEXT TEXT>... Default value that should be set for a column
288
- -d, --detect-types Detect types for columns in CSV/TSV data
289
+ -d, --detect-types Detect types for columns in CSV/TSV data (default)
290
+ --no-detect-types Treat all CSV/TSV columns as TEXT
289
291
  --analyze Run ANALYZE at the end of this operation
290
292
  --load-extension TEXT Path to SQLite extension, with optional :entrypoint
291
293
  --silent Do not show progress bar
@@ -342,7 +344,8 @@ See :ref:`cli_upsert`.
342
344
  --alter Alter existing table to add any missing columns
343
345
  --not-null TEXT Columns that should be created as NOT NULL
344
346
  --default <TEXT TEXT>... Default value that should be set for a column
345
- -d, --detect-types Detect types for columns in CSV/TSV data
347
+ -d, --detect-types Detect types for columns in CSV/TSV data (default)
348
+ --no-detect-types Treat all CSV/TSV columns as TEXT
346
349
  --analyze Run ANALYZE at the end of this operation
347
350
  --load-extension TEXT Path to SQLite extension, with optional :entrypoint
348
351
  --silent Do not show progress bar
@@ -374,7 +377,7 @@ See :ref:`cli_bulk`.
374
377
 
375
378
  Options:
376
379
  --batch-size INTEGER Commit every X records
377
- --functions TEXT Python code defining one or more custom SQL functions
380
+ --functions TEXT Python code or file path defining custom SQL functions
378
381
  --flatten Flatten nested JSON objects, so {"a": {"b": 1}} becomes
379
382
  {"a_b": 1}
380
383
  --nl Expect newline-delimited JSON
@@ -423,14 +426,15 @@ See :ref:`cli_search`.
423
426
  --tsv Output TSV
424
427
  --no-headers Omit CSV headers
425
428
  -t, --table Output as a formatted table
426
- --fmt TEXT Table format - one of asciidoc, double_grid,
427
- double_outline, fancy_grid, fancy_outline, github,
428
- grid, heavy_grid, heavy_outline, html, jira, latex,
429
- latex_booktabs, latex_longtable, latex_raw, mediawiki,
430
- mixed_grid, mixed_outline, moinmoin, orgtbl, outline,
431
- pipe, plain, presto, pretty, psql, rounded_grid,
432
- rounded_outline, rst, simple, simple_grid,
433
- simple_outline, textile, tsv, unsafehtml, youtrack
429
+ --fmt TEXT Table format - one of asciidoc, colon_grid,
430
+ double_grid, double_outline, fancy_grid, fancy_outline,
431
+ github, grid, heavy_grid, heavy_outline, html, jira,
432
+ latex, latex_booktabs, latex_longtable, latex_raw,
433
+ mediawiki, mixed_grid, mixed_outline, moinmoin, orgtbl,
434
+ outline, pipe, plain, presto, pretty, psql,
435
+ rounded_grid, rounded_outline, rst, simple,
436
+ simple_grid, simple_outline, textile, tsv, unsafehtml,
437
+ youtrack
434
438
  --json-cols Detect JSON cols and output them as JSON, not escaped
435
439
  strings
436
440
  --load-extension TEXT Path to SQLite extension, with optional :entrypoint
@@ -457,8 +461,8 @@ See :ref:`cli_transform_table`.
457
461
  --rename column2 column_renamed
458
462
 
459
463
  Options:
460
- --type <TEXT CHOICE>... Change column type to INTEGER, TEXT, FLOAT or
461
- BLOB
464
+ --type <TEXT CHOICE>... Change column type to INTEGER, TEXT, FLOAT,
465
+ REAL or BLOB
462
466
  --drop TEXT Drop this column
463
467
  --rename <TEXT TEXT>... Rename this column to X
464
468
  -o, --column-order TEXT Reorder columns
@@ -613,11 +617,13 @@ See :ref:`cli_convert`.
613
617
 
614
618
  The following common operations are available as recipe functions:
615
619
 
616
- r.jsonsplit(value, delimiter=',', type=<class 'str'>)
620
+ r.jsonsplit(value: 'str', delimiter: 'str' = ',', type: 'Callable[[str],
621
+ object]' = <class 'str'>) -> 'str'
617
622
 
618
623
  Convert a string like a,b,c into a JSON array ["a", "b", "c"]
619
624
 
620
- r.parsedate(value, dayfirst=False, yearfirst=False, errors=None)
625
+ r.parsedate(value: 'str', dayfirst: 'bool' = False, yearfirst: 'bool' = False,
626
+ errors: 'Optional[object]' = None) -> 'Optional[str]'
621
627
 
622
628
  Parse a date and convert it to ISO date format: yyyy-mm-dd
623
629
 
@@ -626,7 +632,8 @@ See :ref:`cli_convert`.
626
632
  - errors=r.IGNORE to ignore values that cannot be parsed
627
633
  - errors=r.SET_NULL to set values that cannot be parsed to null
628
634
 
629
- r.parsedatetime(value, dayfirst=False, yearfirst=False, errors=None)
635
+ r.parsedatetime(value: 'str', dayfirst: 'bool' = False, yearfirst: 'bool' =
636
+ False, errors: 'Optional[object]' = None) -> 'Optional[str]'
630
637
 
631
638
  Parse a datetime and convert it to ISO datetime format: yyyy-mm-ddTHH:MM:SS
632
639
 
@@ -653,7 +660,6 @@ See :ref:`cli_convert`.
653
660
  --output-type [integer|float|blob|text]
654
661
  Column type to use for the output column
655
662
  --drop Drop original column afterwards
656
- --no-skip-false Don't skip falsey values
657
663
  -s, --silent Don't show a progress bar
658
664
  --pdb Open pdb debugger on first error
659
665
  -h, --help Show this message and exit.
@@ -686,14 +692,15 @@ See :ref:`cli_tables`.
686
692
  --tsv Output TSV
687
693
  --no-headers Omit CSV headers
688
694
  -t, --table Output as a formatted table
689
- --fmt TEXT Table format - one of asciidoc, double_grid,
690
- double_outline, fancy_grid, fancy_outline, github,
691
- grid, heavy_grid, heavy_outline, html, jira, latex,
692
- latex_booktabs, latex_longtable, latex_raw, mediawiki,
693
- mixed_grid, mixed_outline, moinmoin, orgtbl, outline,
694
- pipe, plain, presto, pretty, psql, rounded_grid,
695
- rounded_outline, rst, simple, simple_grid,
696
- simple_outline, textile, tsv, unsafehtml, youtrack
695
+ --fmt TEXT Table format - one of asciidoc, colon_grid,
696
+ double_grid, double_outline, fancy_grid, fancy_outline,
697
+ github, grid, heavy_grid, heavy_outline, html, jira,
698
+ latex, latex_booktabs, latex_longtable, latex_raw,
699
+ mediawiki, mixed_grid, mixed_outline, moinmoin, orgtbl,
700
+ outline, pipe, plain, presto, pretty, psql,
701
+ rounded_grid, rounded_outline, rst, simple,
702
+ simple_grid, simple_outline, textile, tsv, unsafehtml,
703
+ youtrack
697
704
  --json-cols Detect JSON cols and output them as JSON, not escaped
698
705
  strings
699
706
  --columns Include list of columns for each table
@@ -727,14 +734,15 @@ See :ref:`cli_views`.
727
734
  --tsv Output TSV
728
735
  --no-headers Omit CSV headers
729
736
  -t, --table Output as a formatted table
730
- --fmt TEXT Table format - one of asciidoc, double_grid,
731
- double_outline, fancy_grid, fancy_outline, github,
732
- grid, heavy_grid, heavy_outline, html, jira, latex,
733
- latex_booktabs, latex_longtable, latex_raw, mediawiki,
734
- mixed_grid, mixed_outline, moinmoin, orgtbl, outline,
735
- pipe, plain, presto, pretty, psql, rounded_grid,
736
- rounded_outline, rst, simple, simple_grid,
737
- simple_outline, textile, tsv, unsafehtml, youtrack
737
+ --fmt TEXT Table format - one of asciidoc, colon_grid,
738
+ double_grid, double_outline, fancy_grid, fancy_outline,
739
+ github, grid, heavy_grid, heavy_outline, html, jira,
740
+ latex, latex_booktabs, latex_longtable, latex_raw,
741
+ mediawiki, mixed_grid, mixed_outline, moinmoin, orgtbl,
742
+ outline, pipe, plain, presto, pretty, psql,
743
+ rounded_grid, rounded_outline, rst, simple,
744
+ simple_grid, simple_outline, textile, tsv, unsafehtml,
745
+ youtrack
738
746
  --json-cols Detect JSON cols and output them as JSON, not escaped
739
747
  strings
740
748
  --columns Include list of columns for each view
@@ -773,15 +781,15 @@ See :ref:`cli_rows`.
773
781
  --tsv Output TSV
774
782
  --no-headers Omit CSV headers
775
783
  -t, --table Output as a formatted table
776
- --fmt TEXT Table format - one of asciidoc, double_grid,
777
- double_outline, fancy_grid, fancy_outline, github,
778
- grid, heavy_grid, heavy_outline, html, jira,
779
- latex, latex_booktabs, latex_longtable, latex_raw,
780
- mediawiki, mixed_grid, mixed_outline, moinmoin,
781
- orgtbl, outline, pipe, plain, presto, pretty,
782
- psql, rounded_grid, rounded_outline, rst, simple,
783
- simple_grid, simple_outline, textile, tsv,
784
- unsafehtml, youtrack
784
+ --fmt TEXT Table format - one of asciidoc, colon_grid,
785
+ double_grid, double_outline, fancy_grid,
786
+ fancy_outline, github, grid, heavy_grid,
787
+ heavy_outline, html, jira, latex, latex_booktabs,
788
+ latex_longtable, latex_raw, mediawiki, mixed_grid,
789
+ mixed_outline, moinmoin, orgtbl, outline, pipe,
790
+ plain, presto, pretty, psql, rounded_grid,
791
+ rounded_outline, rst, simple, simple_grid,
792
+ simple_outline, textile, tsv, unsafehtml, youtrack
785
793
  --json-cols Detect JSON cols and output them as JSON, not
786
794
  escaped strings
787
795
  --load-extension TEXT Path to SQLite extension, with optional
@@ -813,14 +821,15 @@ See :ref:`cli_triggers`.
813
821
  --tsv Output TSV
814
822
  --no-headers Omit CSV headers
815
823
  -t, --table Output as a formatted table
816
- --fmt TEXT Table format - one of asciidoc, double_grid,
817
- double_outline, fancy_grid, fancy_outline, github,
818
- grid, heavy_grid, heavy_outline, html, jira, latex,
819
- latex_booktabs, latex_longtable, latex_raw, mediawiki,
820
- mixed_grid, mixed_outline, moinmoin, orgtbl, outline,
821
- pipe, plain, presto, pretty, psql, rounded_grid,
822
- rounded_outline, rst, simple, simple_grid,
823
- simple_outline, textile, tsv, unsafehtml, youtrack
824
+ --fmt TEXT Table format - one of asciidoc, colon_grid,
825
+ double_grid, double_outline, fancy_grid, fancy_outline,
826
+ github, grid, heavy_grid, heavy_outline, html, jira,
827
+ latex, latex_booktabs, latex_longtable, latex_raw,
828
+ mediawiki, mixed_grid, mixed_outline, moinmoin, orgtbl,
829
+ outline, pipe, plain, presto, pretty, psql,
830
+ rounded_grid, rounded_outline, rst, simple,
831
+ simple_grid, simple_outline, textile, tsv, unsafehtml,
832
+ youtrack
824
833
  --json-cols Detect JSON cols and output them as JSON, not escaped
825
834
  strings
826
835
  --load-extension TEXT Path to SQLite extension, with optional :entrypoint
@@ -852,14 +861,15 @@ See :ref:`cli_indexes`.
852
861
  --tsv Output TSV
853
862
  --no-headers Omit CSV headers
854
863
  -t, --table Output as a formatted table
855
- --fmt TEXT Table format - one of asciidoc, double_grid,
856
- double_outline, fancy_grid, fancy_outline, github,
857
- grid, heavy_grid, heavy_outline, html, jira, latex,
858
- latex_booktabs, latex_longtable, latex_raw, mediawiki,
859
- mixed_grid, mixed_outline, moinmoin, orgtbl, outline,
860
- pipe, plain, presto, pretty, psql, rounded_grid,
861
- rounded_outline, rst, simple, simple_grid,
862
- simple_outline, textile, tsv, unsafehtml, youtrack
864
+ --fmt TEXT Table format - one of asciidoc, colon_grid,
865
+ double_grid, double_outline, fancy_grid, fancy_outline,
866
+ github, grid, heavy_grid, heavy_outline, html, jira,
867
+ latex, latex_booktabs, latex_longtable, latex_raw,
868
+ mediawiki, mixed_grid, mixed_outline, moinmoin, orgtbl,
869
+ outline, pipe, plain, presto, pretty, psql,
870
+ rounded_grid, rounded_outline, rst, simple,
871
+ simple_grid, simple_outline, textile, tsv, unsafehtml,
872
+ youtrack
863
873
  --json-cols Detect JSON cols and output them as JSON, not escaped
864
874
  strings
865
875
  --load-extension TEXT Path to SQLite extension, with optional :entrypoint
@@ -956,6 +966,44 @@ See :ref:`cli_create_index`.
956
966
  -h, --help Show this message and exit.
957
967
 
958
968
 
969
+ .. _cli_ref_migrate:
970
+
971
+ migrate
972
+ =======
973
+
974
+ See :ref:`cli_migrate`.
975
+
976
+ ::
977
+
978
+ Usage: sqlite-utils migrate [OPTIONS] DB_PATH [MIGRATIONS]...
979
+
980
+ Apply pending database migrations.
981
+
982
+ Usage:
983
+
984
+ sqlite-utils migrate database.db
985
+
986
+ This will find the migrations.py file in the current directory or
987
+ subdirectories and apply any pending migrations.
988
+
989
+ Or pass paths to one or more migrations.py files directly:
990
+
991
+ sqlite-utils migrate database.db path/to/migrations.py
992
+
993
+ Pass --list to see a list of applied and pending migrations without applying
994
+ them.
995
+
996
+ Use --stop-before migration_set:name to stop before a migration. This option
997
+ can be used multiple times.
998
+
999
+ Options:
1000
+ --stop-before TEXT Stop before applying this migration. Use set:name to
1001
+ target a migration set.
1002
+ --list List migrations without running them
1003
+ -v, --verbose Show verbose output
1004
+ -h, --help Show this message and exit.
1005
+
1006
+
959
1007
  .. _cli_ref_enable_fts:
960
1008
 
961
1009
  enable-fts
@@ -1143,7 +1191,7 @@ See :ref:`cli_add_column`.
1143
1191
  ::
1144
1192
 
1145
1193
  Usage: sqlite-utils add-column [OPTIONS] PATH TABLE COL_NAME
1146
- [[integer|int|float|text|str|blob|bytes]]
1194
+ [[integer|int|float|real|text|str|blob|bytes]]
1147
1195
 
1148
1196
  Add a column to the specified table
1149
1197
 
@@ -1479,7 +1527,7 @@ See :ref:`cli_spatialite`.
1479
1527
  paths. To load it from a specific path, use --load-extension.
1480
1528
 
1481
1529
  Options:
1482
- -t, --type [POINT|LINESTRING|POLYGON|MULTIPOINT|MULTILINESTRING|MULTIPOLYGON|GEOMETRYCOLLECTION|GEOMETRY]
1530
+ -t, --type [point|linestring|polygon|multipoint|multilinestring|multipolygon|geometrycollection|geometry]
1483
1531
  Specify a geometry type for this column.
1484
1532
  [default: GEOMETRY]
1485
1533
  --srid INTEGER Spatial Reference ID. See