sqlite-utils 3.39__tar.gz → 4.0a1__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 (81) hide show
  1. {sqlite_utils-3.39/sqlite_utils.egg-info → sqlite_utils-4.0a1}/PKG-INFO +18 -32
  2. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/docs/changelog.rst +23 -8
  3. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/docs/cli-reference.rst +7 -24
  4. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/docs/cli.rst +143 -171
  5. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/docs/contributing.rst +4 -9
  6. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/docs/python-api.rst +294 -240
  7. sqlite_utils-4.0a1/pyproject.toml +82 -0
  8. sqlite_utils-4.0a1/setup.cfg +4 -0
  9. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/sqlite_utils/cli.py +70 -46
  10. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/sqlite_utils/db.py +599 -340
  11. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/sqlite_utils/recipes.py +4 -0
  12. {sqlite_utils-3.39 → sqlite_utils-4.0a1/sqlite_utils.egg-info}/PKG-INFO +18 -32
  13. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/sqlite_utils.egg-info/SOURCES.txt +2 -3
  14. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/sqlite_utils.egg-info/requires.txt +13 -16
  15. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_cli.py +274 -174
  16. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_cli_convert.py +8 -16
  17. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_cli_insert.py +17 -17
  18. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_cli_memory.py +15 -15
  19. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_convert.py +3 -2
  20. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_create.py +189 -72
  21. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_duplicate.py +6 -6
  22. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_enable_counts.py +11 -11
  23. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_extract.py +21 -21
  24. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_extracts.py +3 -3
  25. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_fts.py +66 -66
  26. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_introspect.py +7 -7
  27. sqlite_utils-4.0a1/tests/test_list_mode.py +288 -0
  28. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_lookup.py +12 -12
  29. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_plugins.py +15 -1
  30. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_recipes.py +24 -14
  31. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_sniff.py +1 -1
  32. sqlite_utils-4.0a1/tests/test_tracer.py +97 -0
  33. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_transform.py +72 -72
  34. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_update.py +4 -3
  35. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_upsert.py +5 -2
  36. sqlite_utils-3.39/setup.cfg +0 -8
  37. sqlite_utils-3.39/setup.py +0 -83
  38. sqlite_utils-3.39/sqlite_utils.egg-info/not-zip-safe +0 -1
  39. sqlite_utils-3.39/tests/test_tracer.py +0 -99
  40. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/LICENSE +0 -0
  41. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/MANIFEST.in +0 -0
  42. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/README.md +0 -0
  43. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/docs/index.rst +0 -0
  44. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/docs/installation.rst +0 -0
  45. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/docs/plugins.rst +0 -0
  46. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/docs/reference.rst +0 -0
  47. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/sqlite_utils/__init__.py +0 -0
  48. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/sqlite_utils/__main__.py +0 -0
  49. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/sqlite_utils/hookspecs.py +0 -0
  50. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/sqlite_utils/plugins.py +0 -0
  51. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/sqlite_utils/py.typed +0 -0
  52. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/sqlite_utils/utils.py +0 -0
  53. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/sqlite_utils.egg-info/dependency_links.txt +0 -0
  54. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/sqlite_utils.egg-info/entry_points.txt +0 -0
  55. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/sqlite_utils.egg-info/top_level.txt +0 -0
  56. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/__init__.py +0 -0
  57. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/conftest.py +0 -0
  58. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_analyze.py +0 -0
  59. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_analyze_tables.py +0 -0
  60. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_attach.py +0 -0
  61. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_cli_bulk.py +0 -0
  62. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_column_affinity.py +0 -0
  63. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_constructor.py +0 -0
  64. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_conversions.py +0 -0
  65. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_create_view.py +0 -0
  66. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_default_value.py +0 -0
  67. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_delete.py +0 -0
  68. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_docs.py +0 -0
  69. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_get.py +0 -0
  70. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_gis.py +0 -0
  71. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_hypothesis.py +0 -0
  72. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_insert_files.py +0 -0
  73. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_m2m.py +0 -0
  74. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_query.py +0 -0
  75. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_recreate.py +0 -0
  76. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_register_function.py +0 -0
  77. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_rows.py +0 -0
  78. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_rows_from_file.py +0 -0
  79. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_suggest_column_types.py +0 -0
  80. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_utils.py +0 -0
  81. {sqlite_utils-3.39 → sqlite_utils-4.0a1}/tests/test_wal.py +0 -0
@@ -1,70 +1,56 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlite-utils
3
- Version: 3.39
3
+ Version: 4.0a1
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
15
+ Classifier: Intended Audience :: Science/Research
18
16
  Classifier: Programming Language :: Python :: 3.10
19
17
  Classifier: Programming Language :: Python :: 3.11
20
18
  Classifier: Programming Language :: Python :: 3.12
21
19
  Classifier: Programming Language :: Python :: 3.13
22
20
  Classifier: Programming Language :: Python :: 3.14
21
+ Classifier: Topic :: Database
23
22
  Requires-Python: >=3.10
24
23
  Description-Content-Type: text/markdown
25
24
  License-File: LICENSE
26
- Requires-Dist: sqlite-fts4
27
- Requires-Dist: click>=8.3.1
25
+ Requires-Dist: click
28
26
  Requires-Dist: click-default-group>=1.2.3
29
- Requires-Dist: tabulate
30
- Requires-Dist: python-dateutil
31
27
  Requires-Dist: pluggy
32
- Requires-Dist: pip
28
+ Requires-Dist: python-dateutil
29
+ Requires-Dist: sqlite-fts4
30
+ Requires-Dist: tabulate
33
31
  Provides-Extra: test
34
- Requires-Dist: pytest; extra == "test"
35
32
  Requires-Dist: black>=24.1.1; extra == "test"
36
- Requires-Dist: hypothesis; extra == "test"
37
33
  Requires-Dist: cogapp; extra == "test"
34
+ Requires-Dist: hypothesis; extra == "test"
35
+ Requires-Dist: pytest; extra == "test"
38
36
  Provides-Extra: docs
37
+ Requires-Dist: beanbag-docutils>=2.0; extra == "docs"
38
+ Requires-Dist: codespell; extra == "docs"
39
39
  Requires-Dist: furo; extra == "docs"
40
+ Requires-Dist: pygments-csv-lexer; extra == "docs"
40
41
  Requires-Dist: sphinx-autobuild; extra == "docs"
41
- Requires-Dist: codespell; extra == "docs"
42
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
43
  Provides-Extra: mypy
44
+ Requires-Dist: data-science-types; extra == "mypy"
46
45
  Requires-Dist: mypy; extra == "mypy"
47
46
  Requires-Dist: types-click; extra == "mypy"
48
- Requires-Dist: types-tabulate; extra == "mypy"
49
- Requires-Dist: types-python-dateutil; extra == "mypy"
50
47
  Requires-Dist: types-pluggy; extra == "mypy"
51
- Requires-Dist: data-science-types; extra == "mypy"
48
+ Requires-Dist: types-python-dateutil; extra == "mypy"
49
+ Requires-Dist: types-tabulate; extra == "mypy"
52
50
  Provides-Extra: flake8
53
51
  Requires-Dist: flake8; extra == "flake8"
54
- Provides-Extra: tui
55
- Requires-Dist: trogon; extra == "tui"
56
- Dynamic: author
57
- Dynamic: classifier
58
- Dynamic: description
59
- Dynamic: description-content-type
60
- Dynamic: home-page
61
- Dynamic: license
52
+ Requires-Dist: flake8-pyproject; extra == "flake8"
62
53
  Dynamic: license-file
63
- Dynamic: project-url
64
- Dynamic: provides-extra
65
- Dynamic: requires-dist
66
- Dynamic: requires-python
67
- Dynamic: summary
68
54
 
69
55
  # sqlite-utils
70
56
 
@@ -4,16 +4,31 @@
4
4
  Changelog
5
5
  ===========
6
6
 
7
- .. _v3_39:
7
+ .. _v4_0a1:
8
8
 
9
- 3.39 (2025-11-24)
10
- -----------------
9
+ 4.0a1 (2025-11-23)
10
+ ------------------
11
+
12
+ - **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`)
13
+ - 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`)
14
+ - **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`)
15
+ - Now uses ``pyproject.toml`` in place of ``setup.py`` for packaging. (:issue:`675`)
16
+ - 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`)
17
+ - **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`)
18
+ - **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`)
19
+ - 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`)
20
+ - **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`)
11
21
 
12
- - Fixed a bug with ``sqlite-utils install`` when the tool had been installed using ``uv``. (:issue:`687`)
13
- - 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`)
14
- - ``sqlite-utils`` now requires on Python 3.10 or higher.
22
+ .. _v4_0a0:
23
+
24
+ 4.0a0 (2025-05-08)
25
+ ------------------
15
26
 
16
- `sqlite-utils 4.0a1 <https://sqlite-utils.datasette.io/en/latest/changelog.html#a1-2025-11-23>`__ is now available as an alpha with some `minor breaking changes <https://simonwillison.net/2025/Nov/24/sqlite-utils-40a1/>`__.
27
+ - Upsert operations now use SQLite's ``INSERT ... ON CONFLICT SET`` syntax on all SQLite versions later than 3.23.1. This is a very slight breaking change for apps that depend on the previous ``INSERT OR IGNORE`` followed by ``UPDATE`` behavior. (:issue:`652`)
28
+ - Python library users can opt-in to the previous implementation by passing ``use_old_upsert=True`` to the ``Database()`` constructor, see :ref:`python_api_old_upsert`.
29
+ - Dropped support for Python 3.8, added support for Python 3.13. (:issue:`646`)
30
+ - ``sqlite-utils tui`` is now provided by the `sqlite-utils-tui <https://github.com/simonw/sqlite-utils-tui>`__ plugin. (:issue:`648`)
31
+ - Test suite now also runs against SQLite 3.23.1, the last version (from 2018-04-10) before the new ``INSERT ... ON CONFLICT SET`` syntax was added. (:issue:`654`)
17
32
 
18
33
  .. _v3_38:
19
34
 
@@ -122,7 +137,7 @@ This release introduces a new :ref:`plugin system <plugins>`. Read more about th
122
137
  3.32 (2023-05-21)
123
138
  -----------------
124
139
 
125
- - New experimental ``sqlite-utils tui`` interface for interactively building command-line invocations, powered by `Trogon <https://github.com/Textualize/trogon>`__. This requires an optional dependency, installed using ``sqlite-utils install trogon``. There is a screenshot :ref:`in the documentation <cli_tui>`. (:issue:`545`)
140
+ - New experimental ``sqlite-utils tui`` interface for interactively building command-line invocations, powered by `Trogon <https://github.com/Textualize/trogon>`__. This requires an optional dependency, installed using ``sqlite-utils install trogon``. (:issue:`545`)
126
141
  - ``sqlite-utils analyze-tables`` command (:ref:`documentation <cli_analyze_tables>`) now has a ``--common-limit 20`` option for changing the number of common/least-common values shown for each column. (:issue:`544`)
127
142
  - ``sqlite-utils analyze-tables --no-most`` and ``--no-least`` options for disabling calculation of most-common and least-common values.
128
143
  - If a column contains only ``null`` values, ``analyze-tables`` will no longer attempt to calculate the most common and least common values for that column. (:issue:`547`)
@@ -65,7 +65,6 @@ This page lists the ``--help`` for every ``sqlite-utils`` CLI sub-command.
65
65
  "create-spatial-index": "cli_spatialite_indexes",
66
66
  "install": "cli_install",
67
67
  "uninstall": "cli_uninstall",
68
- "tui": "cli_tui",
69
68
  }
70
69
  commands.sort(key = lambda command: go_first.index(command) if command in go_first else 999)
71
70
  cog.out("\n")
@@ -286,7 +285,8 @@ See :ref:`cli_inserting_data`, :ref:`cli_insert_csv_tsv`, :ref:`cli_insert_unstr
286
285
  --alter Alter existing table to add any missing columns
287
286
  --not-null TEXT Columns that should be created as NOT NULL
288
287
  --default <TEXT TEXT>... Default value that should be set for a column
289
- -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
290
290
  --analyze Run ANALYZE at the end of this operation
291
291
  --load-extension TEXT Path to SQLite extension, with optional :entrypoint
292
292
  --silent Do not show progress bar
@@ -343,7 +343,8 @@ See :ref:`cli_upsert`.
343
343
  --alter Alter existing table to add any missing columns
344
344
  --not-null TEXT Columns that should be created as NOT NULL
345
345
  --default <TEXT TEXT>... Default value that should be set for a column
346
- -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
347
348
  --analyze Run ANALYZE at the end of this operation
348
349
  --load-extension TEXT Path to SQLite extension, with optional :entrypoint
349
350
  --silent Do not show progress bar
@@ -458,8 +459,8 @@ See :ref:`cli_transform_table`.
458
459
  --rename column2 column_renamed
459
460
 
460
461
  Options:
461
- --type <TEXT CHOICE>... Change column type to INTEGER, TEXT, FLOAT or
462
- BLOB
462
+ --type <TEXT CHOICE>... Change column type to INTEGER, TEXT, FLOAT,
463
+ REAL or BLOB
463
464
  --drop TEXT Drop this column
464
465
  --rename <TEXT TEXT>... Rename this column to X
465
466
  -o, --column-order TEXT Reorder columns
@@ -654,7 +655,6 @@ See :ref:`cli_convert`.
654
655
  --output-type [integer|float|blob|text]
655
656
  Column type to use for the output column
656
657
  --drop Drop original column afterwards
657
- --no-skip-false Don't skip falsey values
658
658
  -s, --silent Don't show a progress bar
659
659
  --pdb Open pdb debugger on first error
660
660
  -h, --help Show this message and exit.
@@ -1045,23 +1045,6 @@ disable-fts
1045
1045
  -h, --help Show this message and exit.
1046
1046
 
1047
1047
 
1048
- .. _cli_ref_tui:
1049
-
1050
- tui
1051
- ===
1052
-
1053
- See :ref:`cli_tui`.
1054
-
1055
- ::
1056
-
1057
- Usage: sqlite-utils tui [OPTIONS]
1058
-
1059
- Open Textual TUI.
1060
-
1061
- Options:
1062
- -h, --help Show this message and exit.
1063
-
1064
-
1065
1048
  .. _cli_ref_optimize:
1066
1049
 
1067
1050
  optimize
@@ -1161,7 +1144,7 @@ See :ref:`cli_add_column`.
1161
1144
  ::
1162
1145
 
1163
1146
  Usage: sqlite-utils add-column [OPTIONS] PATH TABLE COL_NAME
1164
- [[integer|int|float|text|str|blob|bytes]]
1147
+ [[integer|int|float|real|text|str|blob|bytes]]
1165
1148
 
1166
1149
  Add a column to the specified table
1167
1150