Simon Willison
8e7d018fa2
Use ON CONFLICT for upsert, refs #652
...
* New upsert implementation, refs #652
* supports_strict now caches on self._supports_strict
PR: https://github.com/simonw/sqlite-utils/pull/653
2025-05-08 20:37:49 -07:00
Simon Willison
0e4e270d44
Test against multiple SQLite versions ( #654 )
...
* Test against pre-upsert SQLite 3.23.1
Borrowed from 8f86d2af6
* Try this on Python 3.9
* select ... from pragma_function_list()
Refs https://github.com/simonw/sqlite-utils/pull/654#issuecomment-2860898278
* Fix spelling error
* Compatible with latest black
* Skip plugin test that needs pragma_function_list
Refs https://github.com/simonw/sqlite-utils/pull/654#issuecomment-2860924225
* Ran cog
2025-05-07 17:49:50 -07:00
Simon Willison
4dc2e2e9c8
Use REAL for floating point columns if table is strict, closes #644
...
Refs #645
2024-11-23 14:27:21 -08:00
Simon Willison
23be5be1dc
create-table now supports multiple --pk, refs #620
2024-03-16 17:05:39 -07:00
Konstantin Baikov
1dc5da3e5d
Use context managers for file writes in tests ( #618 )
...
This removes the need to explicitly close files
and avoids accidental unclosed files
2024-03-14 21:20:19 -07:00
Taj Khattra
1500c19bd0
Add more STRICT table support ( #604 )
...
* Add more STRICT table support per https://github.com/simonw/sqlite-utils/issues/344#issuecomment-982014776 .
* Make `table.transform()` preserve STRICT mode.
* Fix mypy failures in PR #604
* Link to SQLITE strict page in a few places
2023-12-07 21:05:27 -08:00
Simon Willison
88bd372205
str, int, bytes aliases for column types, closes #606
2023-12-06 10:49:21 -08:00
Simon Willison
56093de078
sqlite-utils transform --add-foreign-key option, closes #585
2023-08-17 18:51:04 -07:00
Simon Willison
d2bcdc00c6
Swapped the order of a bunch of pytest comparisons
...
When I wrote this I thought constant == value was a better assertion. I no longer think that.
2023-08-17 18:05:13 -07:00
Simon Willison
b4735f794a
Remove test.utils.collapse_whitespace, closes #583
2023-08-17 17:59:09 -07:00
Simon Willison
509857ee87
.add_foreign_keys() uses .transform() instead of PRAGMA writable_schema
...
Closes #577
This should solve all sorts of problems seen by users of platforms that throw errors on writable_schema.
Also added `add_foreign_keys=` and `foreign_keys=` parameters to `table.transform()`.
2023-08-17 17:48:08 -07:00
Simon Willison
18f190e283
sqlite-utils rename-table command, refs #565
2023-07-22 12:48:04 -07:00
Simon Willison
f7af23837d
--empty-null option for CSV and TSV imports, closes #563
2023-07-02 22:42:26 -07:00
Simon Willison
f5c63088e1
Use sqlean if available in environment ( #560 )
...
Closes #559
Closes #235
Refs https://github.com/simonw/llm/issues/60
- Uses `sqlean` in place of `sqlite3` if `sqlean.py` is installed
- Uses `sqlite-dump` if available and `conn.iterdump()` does not exist
- New `with db.ensure_autocommit_off()` method for ensuring autocommit is off, used by `enable_wal()` and `disable_wal()`.
2023-06-25 16:25:51 -07:00
Simon Willison
a256d7de98
Fix a bunch of warnings in the tests, refs #541
2023-05-08 12:57:43 -07:00
Simon Willison
373b7886d2
--raw-lines option, closes #539
2023-05-07 11:26:14 -07:00
Simon Willison
7b2d1c0ffd
Update tests for Python 3.11, closes #502
2022-10-25 12:23:27 -07:00
Simon Willison
34e75ed0dd
sqlite_utils.utils.flatten() function, closes #500
2022-10-18 11:00:35 -07:00
Simon Willison
19dd077944
Support entrypoints for --load-extension ( #473 )
...
* Entrypoint support, closes #470
2022-08-26 22:55:47 -07:00
Simon Willison
85e7411bbd
Skip test if pragma_function_list not supported, refs #471
2022-08-26 22:01:58 -07:00
Simon Willison
31f062d4a7
sqlite-utils query --functions option, refs #471
2022-08-26 21:53:55 -07:00
Simon Willison
7a9a6363ff
sqlite-utils rows --order option, closes #469
2022-08-26 21:10:20 -07:00
Simon Willison
b9a89a0f2c
duplicate --ignore option, refs #450
2022-07-15 15:35:58 -07:00
Simon Willison
5fa823f03f
add-column --ignore option, refs #450
2022-07-15 15:31:37 -07:00
Simon Willison
2c77f4467e
Add --ignore to create-index as alias of --if-not-exists, refs #450
2022-07-15 15:25:49 -07:00
Simon Willison
40b6947255
enable-fts --replace option, refs #450
...
Also fixed up some sqlite3.OperationalError imports.
2022-07-15 15:20:26 -07:00
Simon Willison
c710ade644
sqlite-utils duplicate command, closes #454 , refs #449
...
Also made it so .duplicate() raises new NoTable exception rather than raising
an AssertionError if the source table does not exist.
2022-07-15 14:45:47 -07:00
Edward Betts
b6c9dfce0b
Correct spelling mistakes (found with codespell) ( #410 )
2022-03-01 13:05:29 -08:00
Chris Amico
a692c56659
Add SpatiaLite helpers to CLI ( #407 )
...
* Add SpatiaLite CLI helpers
* Add docs for spaitalite helpers
* Fix flake8 issues and add more detail on spatial types
* Run cog and add some help text.
* Use SpatiaLite when calculating coverage, refs #407
Co-authored-by: Simon Willison <swillison@gmail.com>
2022-02-15 16:58:07 -08:00
Simon Willison
be1e89da5f
Fixed flake8 errors
2022-01-25 19:22:06 -08:00
Simon Willison
2b20957b18
Better validation for upsert --pk, closes #390
2022-01-25 19:19:39 -08:00
Simon Willison
3b632f0a7e
sqlite-utils rows --where and -p options, closes #382
2022-01-11 15:32:43 -08:00
Simon Willison
324ebc3130
sqlite-utils rows --limit and --offset options, closes #381
2022-01-11 15:19:29 -08:00
Simon Willison
1b84c175b4
--analyze option for create-index, insert, update commands, closes #379 , closes #365
2022-01-10 17:36:41 -08:00
Simon Willison
e0ef9288fe
sqlite-utils analyze command, refs #379
2022-01-10 17:24:17 -08:00
Simon Willison
1d64cd2e5b
sqlite-utils create-database command, closes #348
2022-01-09 12:33:16 -08:00
Simon Willison
b8c134059e
--fmt now implies --table, closes #374
2022-01-09 10:07:48 -08:00
Simon Willison
e0c476bc38
Fix test for Python 3.6, refs #368
2022-01-08 18:37:53 -08:00
Simon Willison
539f5ccd90
Support 'python -m sqlite_utils', closes #368
...
Refs #364
2022-01-08 18:33:22 -08:00
Simon Willison
a7b29bfaa9
Fixed bug with sqlite-utils upsert --detect-types, closes #362
2022-01-05 22:28:29 -08:00
Simon Willison
d1ed2f423d
Refactored sqlite-utils insert tests into test_cli_insert.py
2022-01-05 22:24:53 -08:00
Simon Willison
3b2a7c0e5b
Refactor test for #149 , spitting it from other rebuild test
...
Also refs #354
2021-12-10 16:56:50 -08:00
Simon Willison
7427a9137f
Output [] in JSON mode if no rows, closes #328
2021-09-22 13:20:04 -07:00
Simon Willison
7e2dcbbbea
Fixed bug with --no-headers --tsv, closes #295
2021-08-18 13:18:54 -07:00
Simon Willison
ccf128cd6d
sqlite-utils search --quote option, closes #296
2021-08-18 13:10:44 -07:00
Simon Willison
a6567ec507
Capture parameters= not params=, refs #309
2021-08-09 15:33:33 -07:00
Simon Willison
14f643d9e9
Better error messages in CLI, closes #309
2021-08-09 15:25:52 -07:00
Simon Willison
f67327abf0
sqlite-utils insert --flatten option, closes #310
2021-08-09 14:44:03 -07:00
Simon Willison
ab8d4aad0c
sqlite-utils schema now takes optional tables, closes #299
2021-07-24 15:08:36 -07:00
Simon Willison
90e211e3e2
Now complies with flake8, refs #291
2021-06-22 18:22:08 -07:00