Commit graph

230 commits

Author SHA1 Message Date
Simon Willison
23be5be1dc create-table now supports multiple --pk, refs #620 2024-03-16 17:05:39 -07:00
Simon Willison
5bd7aec4d2
Test against Python 3.13 pre-release (#619)
* Test against Python 3.13 pre-release

* Skip tests for numpy on Python 3.13

Refs https://github.com/simonw/sqlite-utils/pull/619#issuecomment-1998798451

* Try to avoid Python 3.13 cog differences

* Hide \b characters in cli-reference

* Fixed .rST warning
2024-03-14 21:14:10 -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
Luke Plant
37273d7f63
Fixed issue #433 - CLI eats cursor (#598)
The issue is that underlying iterator is not fully consumed within the body of
the `with file_progress()` block. Instead, that block creates generator
expressions like `docs = (dict(zip(headers, row)) for row in reader)`

These iterables are consumed later, outside the `with file_progress()` block,
which consumes the underlying iterator, and in turn updates the progress bar.

This means that the `ProgressBar.__exit__` method gets called before the last
time the `ProgressBar.update` method gets called. The result is that the code to
make the cursor invisible (inside the `update()` method) is called after the
cleanup code to make it visible (in the `__exit__` method).

The fix is to move consumption of the `docs` iterators within the progress bar block.

(An additional fix, to make ProgressBar more robust against this kind of misuse, would
to make it refusing to update after its `__exit__` method had been called, just
like files cannot be `read()` after they are closed. That requires a in the
click library).
2023-11-03 17:40:29 -07:00
Simon Willison
56093de078 sqlite-utils transform --add-foreign-key option, closes #585 2023-08-17 18:51:04 -07:00
Simon Willison
70717dc0e1 Remove unneccessary warning, refs #577, #585 2023-08-17 18:28:09 -07:00
Simon Willison
619cea8681 sqlite-utils convert --pdb option, closes #581 2023-07-26 14:06:05 -07:00
Simon Willison
5e9a02153d Fix bug with --editable
See also: https://github.com/simonw/llm/issues/136
2023-07-25 22:20:49 -07:00
Simon Willison
c728c25555 Undo change which broke the tests 2023-07-22 16:25:14 -07:00
Simon Willison
778dad789e More robust _called_from_test pattern 2023-07-22 16:21:27 -07:00
Simon Willison
18f190e283 sqlite-utils rename-table command, refs #565 2023-07-22 12:48:04 -07:00
Simon Willison
2d55f185ff Applied Black, refs #568 2023-07-22 12:22:15 -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
ef31210bf0 sqlite-utils install -e, closes #570 2023-07-22 11:32:42 -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
63dc7ab1a5 Fixed a complaint from ruff check 2023-06-29 13:41:08 -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
e0ec4c3451 --no-skip-false option, plus docs - closes #527 2023-05-08 14:03:20 -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
4fc2f12c88 Fix ResourceWarning in sqlite-utils insert, refs #534 2023-05-08 12:39:06 -07:00
Simon Willison
373b7886d2 --raw-lines option, closes #539 2023-05-07 11:26:14 -07:00
Simon Willison
ebe504ab21 Clarify column types in create-table help 2022-11-29 09:03:35 -08:00
Simon Willison
34e75ed0dd sqlite_utils.utils.flatten() function, closes #500 2022-10-18 11:00:35 -07:00
Simon Willison
85247038f7 install and uninstall commands, closes #483 2022-09-26 11:57:11 -07:00
Mischa Untaga
0b315d3fa8
progressbar for inserts/upserts of other file formats
* progressbar for inserts/upserts of other file formats, closes #485
* Pin to Python 3.10.6 for the moment as workaround for mypy error

Co-authored-by: Simon Willison <swillison@gmail.com>
2022-09-15 13:37:51 -07:00
Simon Willison
104f37fa4d
db[table].create(..., transform=True) and create-table --transform
Closes #467
2022-08-27 16:17:55 -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
23ef1d6c20 bulk --functions, closes #471 2022-08-26 22:10:43 -07:00
Simon Willison
59e2cfbdc1 sqlite-utils memory --functions, refs #471 2022-08-26 22:03:53 -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
9dd4cf891d Improve CLI help for drop-table and drop-view, refs #450 2022-07-15 15:09:07 -07:00
Simon Willison
015c663464 Fixed lint errors, refs #454 2022-07-15 14:59:06 -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
Simon Willison
0cee77b176 Update test for renamed restkey, refs #440, #443 2022-06-14 14:14:20 -07:00
Simon Willison
93fa79d30b Ignore flake8 lambda errors, refs #415 2022-03-20 21:22:09 -07:00
Simon Willison
751ab205ac Fix for --multi combined with --dry-run, closes #415 2022-03-20 21:18:18 -07:00
Simon Willison
878d5f5cea errors=r.SET_NULL/r.IGNORE options for parsedate/parsedatetime, closes #416 2022-03-20 21:01:35 -07:00