sqlite-utils/tests
Simon Willison fafa966300 Table.create() now stores configuration in _defaults
When configuration parameters like pk, foreign_keys, not_null, etc.
are passed to Table.create(), they are now stored in self._defaults
so that subsequent operations on the same Table instance (like insert,
upsert) will use those settings automatically.

Previously, calling db["table"].insert({...}, pk="id") would create
the table correctly but subsequent calls to insert() or upsert() on
the same table object would not know about the pk setting, causing
issues like upsert() failing with "requires a pk" error.

Closes #655

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 15:18:55 -08:00
..
sniff sqlite-utils insert --sniff option, closes #230 2021-02-14 11:23:12 -08:00
__init__.py Initial project layout + database table creation tools 2018-07-28 06:46:17 -07:00
conftest.py Added pluggy and first hook, register_commands - refs #569, #567 2023-07-22 12:04:31 -07:00
ext.c Support entrypoints for --load-extension (#473) 2022-08-26 22:55:47 -07:00
test_analyze.py Use sqlean if available in environment (#560) 2023-06-25 16:25:51 -07:00
test_analyze_tables.py Use sqlean if available in environment (#560) 2023-06-25 16:25:51 -07:00
test_attach.py db.attach(alias, filepath) method, closes #113 2021-02-18 20:56:32 -08:00
test_cli.py Use ON CONFLICT for upsert, refs #652 2025-05-08 20:37:49 -07:00
test_cli_bulk.py bulk --functions, closes #471 2022-08-26 22:10:43 -07:00
test_cli_convert.py Swapped the order of a bunch of pytest comparisons 2023-08-17 18:05:13 -07:00
test_cli_insert.py Test for insert CLI with multiple --pk, refs #621 2024-03-16 17:26:02 -07:00
test_cli_memory.py Neater return_db pattern for reusing memory command, closes #643 2024-11-08 12:11:17 -08:00
test_column_affinity.py Tracer mechanism for showing underlying SQL queries 2020-09-07 14:56:59 -07:00
test_constructor.py db.close() method, closes #504 2022-10-25 13:57:43 -07:00
test_conversions.py Now complies with flake8, refs #291 2021-06-22 18:22:08 -07:00
test_convert.py Applied Black, refs #526, #525 2023-05-08 14:54:24 -07:00
test_create.py Table.create() now stores configuration in _defaults 2025-11-23 15:18:55 -08:00
test_create_view.py Tracer mechanism for showing underlying SQL queries 2020-09-07 14:56:59 -07:00
test_default_value.py Transform no longer breaks non-string default values 2023-05-08 14:13:36 -07:00
test_delete.py Swapped the order of a bunch of pytest comparisons 2023-08-17 18:05:13 -07:00
test_docs.py Added pluggy and first hook, register_commands - refs #569, #567 2023-07-22 12:04:31 -07:00
test_duplicate.py sqlite-utils duplicate command, closes #454, refs #449 2022-07-15 14:45:47 -07:00
test_enable_counts.py db.table() only returns tables, added db.view() 2025-05-08 23:19:36 -07:00
test_extract.py .add_foreign_keys() uses .transform() instead of PRAGMA writable_schema 2023-08-17 17:48:08 -07:00
test_extracts.py Port from setup.py to pyproject.toml 2025-11-23 14:07:11 -08:00
test_fts.py include_rank parameter for Table.search 2024-11-23 12:34:27 -08:00
test_get.py Refactored tests into new test_rows.py, refs #76 2020-04-15 18:04:55 -07:00
test_gis.py Swapped the order of a bunch of pytest comparisons 2023-08-17 18:05:13 -07:00
test_hypothesis.py Now complies with flake8, refs #291 2021-06-22 18:22:08 -07:00
test_insert_files.py insert-files multiple --pk support, closes #621 2024-03-16 17:33:31 -07:00
test_introspect.py Swapped the order of a bunch of pytest comparisons 2023-08-17 18:05:13 -07:00
test_list_mode.py table.insert_all() and table.upsert_all() now take generators of lists/tuples 2025-11-23 12:17:23 -08:00
test_lookup.py Add more STRICT table support (#604) 2023-12-07 21:05:27 -08:00
test_m2m.py Swapped the order of a bunch of pytest comparisons 2023-08-17 18:05:13 -07:00
test_plugins.py Test against multiple SQLite versions (#654) 2025-05-07 17:49:50 -07:00
test_query.py Tests for db.query() method, refs #290 2021-06-22 10:43:49 -07:00
test_recipes.py table.insert_all() and table.upsert_all() now take generators of lists/tuples 2025-11-23 12:17:23 -08:00
test_recreate.py Use new db.close() method, refs #504 2022-10-25 14:00:53 -07:00
test_register_function.py Removed FunctionAlreadyRegistered error, refs #526, #525 2023-05-08 14:58:28 -07:00
test_rows.py Now complies with flake8, refs #291 2021-06-22 18:22:08 -07:00
test_rows_from_file.py Better error message if rows_from_file called with StringIO, closes #520 2023-05-08 15:08:02 -07:00
test_sniff.py sqlite-utils insert --sniff option, closes #230 2021-02-14 11:23:12 -08:00
test_suggest_column_types.py Fixed bug with null columns, closes #95 2020-03-23 13:31:06 -07:00
test_tracer.py db.table() only returns tables, added db.view() 2025-05-08 23:19:36 -07:00
test_transform.py Recreate indexes when calling transform when possible (#634) 2024-11-23 12:17:15 -08:00
test_update.py Swapped the order of a bunch of pytest comparisons 2023-08-17 18:05:13 -07:00
test_upsert.py Use ON CONFLICT for upsert, refs #652 2025-05-08 20:37:49 -07:00
test_utils.py sqlite_utils.utils.flatten() function, closes #500 2022-10-18 11:00:35 -07:00
test_wal.py Now complies with flake8, refs #291 2021-06-22 18:22:08 -07:00