Simon Willison
2258b431d4
Neater return_db pattern for reusing memory command, closes #643
2024-11-08 12:11:17 -08:00
Simon Willison
8906f57740
Hack to support reuse of memory command, closes #643
2024-11-08 11:17:17 -08:00
Simon Willison
1d050dcdc7
insert-files multiple --pk support, closes #621
2024-03-16 17:33:31 -07:00
Simon Willison
da92a30679
Test for insert CLI with multiple --pk, refs #621
2024-03-16 17:26:02 -07: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
b2e0cd066d
Test and docs for timedelta support, refs #522
2023-11-03 17:56:34 -07:00
Simon Willison
1c6ea54338
.transform() now preserves rowid values
...
* .transform() now preserves rowid values, refs #592
* Test transform rowids against different table types, closes #592
2023-09-08 17:45:30 -07: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
993029f466
flake8 fixes
2023-08-17 17:19:02 -07:00
Simon Willison
374a816c72
Database(..., execute_plugins=False) mechanism, refs #575
2023-07-22 16:06:11 -07:00
Alex Garcia
3f80a02698
prepare_connection plugin hook
...
Closes:
- #574
Refs #567
---------
Co-authored-by: Simon Willison <swillison@gmail.com>
2023-07-22 15:59:08 -07:00
Simon Willison
61aaa69815
.transform(..., keep_table=name) parameter, closes #571
...
Also type hints for the transform_sql() method
2023-07-22 15:32:09 -07:00
Simon Willison
18f190e283
sqlite-utils rename-table command, refs #565
2023-07-22 12:48:04 -07:00
Simon Willison
82e8cd3667
db.rename_table() method, refs #565
2023-07-22 12:38:31 -07:00
Simon Willison
0c563e2d13
Fixed test I broke in #568
2023-07-22 12:23:42 -07:00
Simon Willison
58b577279f
table.create(..., replace=True / ignore = True) closes #568
2023-07-22 12:15:40 -07:00
Simon Willison
b379a2a0c3
Added pluggy and first hook, register_commands - refs #569 , #567
2023-07-22 12:04:31 -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
8c739558f7
--stop-after option, closes #561
2023-06-27 11:50:04 -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
718b0cba9b
Experimental TUI powered by Trogon
...
* sqlite-utils tui command if Trogon is installed, closes #545
* Documentation for trogon TUI
* Screenshot of TUI
* Ignore trogon mypy error
* only run flake8 on Python 3.8 or higher, closes #550
2023-05-21 11:41:56 -07:00
Simon Willison
e8c5b042e4
Validate column names in analyze-columns, closes #548
2023-05-21 10:35:48 -07:00
Simon Willison
6027f3ea69
No need to show common values if everything is null
...
Closes #547
2023-05-21 10:19:16 -07:00
Simon Willison
d2a7b15b2b
Analyze tables options: --common-limit, --no-most, --no-least
...
Closes #544
2023-05-21 09:19:30 -07:00
Simon Willison
dab23884ae
Better error message if rows_from_file called with StringIO, closes #520
...
Refs #448
2023-05-08 15:08:02 -07:00
Simon Willison
eebd1a26ae
Removed FunctionAlreadyRegistered error, refs #526 , #525
2023-05-08 14:58:28 -07:00
Simon Willison
fca3ef8cf2
Applied Black, refs #526 , #525
2023-05-08 14:54:24 -07:00
Martin Carpenter
02f5c4d69d
Support repeated calls to Table.convert()
...
* Test repeated calls to Table.convert()
* Register Table.convert() functions under their own `lambda_hash` name
* Raise exception on registering identical function names
Refs #525
2023-05-08 14:53:58 -07:00
rhoboro
6500fed8b2
Transform no longer breaks non-string default values
...
Closes #509
2023-05-08 14:13:36 -07:00
Simon Willison
923768db2e
Assert on exact error message, refs #537
2023-05-08 14:11:48 -07:00
Scott Perry
39ef137e67
Support self-referencing FKs in create ( #537 )
2023-05-08 14:10:00 -07:00
Simon Willison
e0ec4c3451
--no-skip-false option, plus docs - closes #527
2023-05-08 14:03:20 -07:00
Simon Willison
455c35b512
.convert(skip_false) option, refs #527
2023-05-08 13:52:21 -07:00
Simon Willison
e4ed372517
Show more detailed error on invalid JSON, closes #532
2023-05-08 13:31:56 -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
2376c452a5
upsert_all() now works with not_null - refs #538
2023-05-08 12:24:19 -07:00
Simon Willison
373b7886d2
--raw-lines option, closes #539
2023-05-07 11:26:14 -07:00
Simon Willison
defa2974c6
jsonify_if_needed output of convert() functions, closes #495
2022-10-25 14:23:24 -07:00
Simon Willison
c7e4308e6f
Use new db.close() method, refs #504
2022-10-25 14:00:53 -07:00
Simon Willison
05e2bb85fc
db.close() method, closes #504
2022-10-25 13:57:43 -07:00
Simon Willison
ba7242b1f2
Try closing the database before recreating it, refs #503
2022-10-25 13:36:17 -07:00
Simon Willison
f6b796277f
Try a 0.1s sleep, refs #503
2022-10-25 13:27:18 -07:00
Simon Willison
079bf1f4dc
Use tmp_path fixture in test_recreate, refs #503
2022-10-25 13:06:58 -07:00
Simon Willison
7b2d1c0ffd
Update tests for Python 3.11, closes #502
2022-10-25 12:23:27 -07:00