sqlite-utils 4.0a0__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-4.0a0/sqlite_utils.egg-info → sqlite_utils-4.0a1}/PKG-INFO +19 -31
  2. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/docs/changelog.rst +15 -0
  3. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/docs/cli-reference.rst +11 -10
  4. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/docs/cli.rst +158 -144
  5. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/docs/contributing.rst +4 -9
  6. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/docs/python-api.rst +287 -240
  7. sqlite_utils-4.0a1/pyproject.toml +82 -0
  8. sqlite_utils-4.0a1/setup.cfg +4 -0
  9. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/sqlite_utils/cli.py +97 -40
  10. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/sqlite_utils/db.py +440 -255
  11. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/sqlite_utils/recipes.py +4 -0
  12. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1/sqlite_utils.egg-info}/PKG-INFO +19 -31
  13. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/sqlite_utils.egg-info/SOURCES.txt +2 -3
  14. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/sqlite_utils.egg-info/requires.txt +12 -11
  15. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_cli.py +343 -169
  16. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_cli_bulk.py +26 -0
  17. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_cli_convert.py +8 -16
  18. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_cli_insert.py +17 -17
  19. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_cli_memory.py +31 -15
  20. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_convert.py +3 -2
  21. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_create.py +184 -69
  22. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_duplicate.py +6 -6
  23. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_enable_counts.py +11 -11
  24. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_extract.py +21 -21
  25. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_extracts.py +3 -3
  26. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_fts.py +66 -66
  27. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_introspect.py +7 -7
  28. sqlite_utils-4.0a1/tests/test_list_mode.py +288 -0
  29. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_lookup.py +12 -12
  30. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_recipes.py +24 -13
  31. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_sniff.py +1 -1
  32. sqlite_utils-4.0a1/tests/test_tracer.py +97 -0
  33. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_transform.py +72 -72
  34. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_update.py +4 -3
  35. sqlite_utils-4.0a0/setup.cfg +0 -8
  36. sqlite_utils-4.0a0/setup.py +0 -82
  37. sqlite_utils-4.0a0/sqlite_utils.egg-info/not-zip-safe +0 -1
  38. sqlite_utils-4.0a0/tests/test_tracer.py +0 -99
  39. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/LICENSE +0 -0
  40. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/MANIFEST.in +0 -0
  41. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/README.md +0 -0
  42. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/docs/index.rst +0 -0
  43. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/docs/installation.rst +0 -0
  44. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/docs/plugins.rst +0 -0
  45. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/docs/reference.rst +0 -0
  46. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/sqlite_utils/__init__.py +0 -0
  47. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/sqlite_utils/__main__.py +0 -0
  48. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/sqlite_utils/hookspecs.py +0 -0
  49. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/sqlite_utils/plugins.py +0 -0
  50. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/sqlite_utils/py.typed +0 -0
  51. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/sqlite_utils/utils.py +0 -0
  52. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/sqlite_utils.egg-info/dependency_links.txt +0 -0
  53. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/sqlite_utils.egg-info/entry_points.txt +0 -0
  54. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/sqlite_utils.egg-info/top_level.txt +0 -0
  55. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/__init__.py +0 -0
  56. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/conftest.py +0 -0
  57. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_analyze.py +0 -0
  58. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_analyze_tables.py +0 -0
  59. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_attach.py +0 -0
  60. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_column_affinity.py +0 -0
  61. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_constructor.py +0 -0
  62. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_conversions.py +0 -0
  63. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_create_view.py +0 -0
  64. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_default_value.py +0 -0
  65. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_delete.py +0 -0
  66. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_docs.py +0 -0
  67. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_get.py +0 -0
  68. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_gis.py +0 -0
  69. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_hypothesis.py +0 -0
  70. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_insert_files.py +0 -0
  71. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_m2m.py +0 -0
  72. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_plugins.py +0 -0
  73. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_query.py +0 -0
  74. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_recreate.py +0 -0
  75. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_register_function.py +0 -0
  76. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_rows.py +0 -0
  77. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_rows_from_file.py +0 -0
  78. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_suggest_column_types.py +0 -0
  79. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_upsert.py +0 -0
  80. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_utils.py +0 -0
  81. {sqlite_utils-4.0a0 → sqlite_utils-4.0a1}/tests/test_wal.py +0 -0
@@ -1,68 +1,56 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlite-utils
3
- Version: 4.0a0
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
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
25
  Requires-Dist: click
29
26
  Requires-Dist: click-default-group>=1.2.3
30
- Requires-Dist: tabulate
31
- Requires-Dist: python-dateutil
32
27
  Requires-Dist: pluggy
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
- Dynamic: author
55
- Dynamic: classifier
56
- Dynamic: description
57
- Dynamic: description-content-type
58
- Dynamic: home-page
59
- Dynamic: license
52
+ Requires-Dist: flake8-pyproject; extra == "flake8"
60
53
  Dynamic: license-file
61
- Dynamic: project-url
62
- Dynamic: provides-extra
63
- Dynamic: requires-dist
64
- Dynamic: requires-python
65
- Dynamic: summary
66
54
 
67
55
  # sqlite-utils
68
56
 
@@ -4,6 +4,21 @@
4
4
  Changelog
5
5
  ===========
6
6
 
7
+ .. _v4_0a1:
8
+
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`)
21
+
7
22
  .. _v4_0a0:
8
23
 
9
24
  4.0a0 (2025-05-08)
@@ -131,7 +131,7 @@ See :ref:`cli_query`.
131
131
  -r, --raw Raw output, first column of first row
132
132
  --raw-lines Raw output, first column of each row
133
133
  -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
135
135
  functions
136
136
  --load-extension TEXT Path to SQLite extension, with optional
137
137
  :entrypoint
@@ -174,7 +174,7 @@ See :ref:`cli_memory`.
174
174
  sqlite-utils memory animals.csv --schema
175
175
 
176
176
  Options:
177
- --functions TEXT Python code defining one or more custom SQL
177
+ --functions TEXT Python code or file path defining custom SQL
178
178
  functions
179
179
  --attach <TEXT FILE>... Additional databases to attach - specify alias and
180
180
  filepath
@@ -285,7 +285,8 @@ See :ref:`cli_inserting_data`, :ref:`cli_insert_csv_tsv`, :ref:`cli_insert_unstr
285
285
  --alter Alter existing table to add any missing columns
286
286
  --not-null TEXT Columns that should be created as NOT NULL
287
287
  --default <TEXT TEXT>... Default value that should be set for a column
288
- -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
289
290
  --analyze Run ANALYZE at the end of this operation
290
291
  --load-extension TEXT Path to SQLite extension, with optional :entrypoint
291
292
  --silent Do not show progress bar
@@ -342,7 +343,8 @@ See :ref:`cli_upsert`.
342
343
  --alter Alter existing table to add any missing columns
343
344
  --not-null TEXT Columns that should be created as NOT NULL
344
345
  --default <TEXT TEXT>... Default value that should be set for a column
345
- -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
346
348
  --analyze Run ANALYZE at the end of this operation
347
349
  --load-extension TEXT Path to SQLite extension, with optional :entrypoint
348
350
  --silent Do not show progress bar
@@ -374,7 +376,7 @@ See :ref:`cli_bulk`.
374
376
 
375
377
  Options:
376
378
  --batch-size INTEGER Commit every X records
377
- --functions TEXT Python code defining one or more custom SQL functions
379
+ --functions TEXT Python code or file path defining custom SQL functions
378
380
  --flatten Flatten nested JSON objects, so {"a": {"b": 1}} becomes
379
381
  {"a_b": 1}
380
382
  --nl Expect newline-delimited JSON
@@ -457,8 +459,8 @@ See :ref:`cli_transform_table`.
457
459
  --rename column2 column_renamed
458
460
 
459
461
  Options:
460
- --type <TEXT CHOICE>... Change column type to INTEGER, TEXT, FLOAT or
461
- BLOB
462
+ --type <TEXT CHOICE>... Change column type to INTEGER, TEXT, FLOAT,
463
+ REAL or BLOB
462
464
  --drop TEXT Drop this column
463
465
  --rename <TEXT TEXT>... Rename this column to X
464
466
  -o, --column-order TEXT Reorder columns
@@ -653,7 +655,6 @@ See :ref:`cli_convert`.
653
655
  --output-type [integer|float|blob|text]
654
656
  Column type to use for the output column
655
657
  --drop Drop original column afterwards
656
- --no-skip-false Don't skip falsey values
657
658
  -s, --silent Don't show a progress bar
658
659
  --pdb Open pdb debugger on first error
659
660
  -h, --help Show this message and exit.
@@ -1143,7 +1144,7 @@ See :ref:`cli_add_column`.
1143
1144
  ::
1144
1145
 
1145
1146
  Usage: sqlite-utils add-column [OPTIONS] PATH TABLE COL_NAME
1146
- [[integer|int|float|text|str|blob|bytes]]
1147
+ [[integer|int|float|real|text|str|blob|bytes]]
1147
1148
 
1148
1149
  Add a column to the specified table
1149
1150
 
@@ -1479,7 +1480,7 @@ See :ref:`cli_spatialite`.
1479
1480
  paths. To load it from a specific path, use --load-extension.
1480
1481
 
1481
1482
  Options:
1482
- -t, --type [POINT|LINESTRING|POLYGON|MULTIPOINT|MULTILINESTRING|MULTIPOLYGON|GEOMETRYCOLLECTION|GEOMETRY]
1483
+ -t, --type [point|linestring|polygon|multipoint|multilinestring|multipolygon|geometrycollection|geometry]
1483
1484
  Specify a geometry type for this column.
1484
1485
  [default: GEOMETRY]
1485
1486
  --srid INTEGER Spatial Reference ID. See