Commit graph

313 commits

Author SHA1 Message Date
Simon Willison
3e87500e15 table.optimize() deletes junk docsize rows
Closes #153. Closes #149.
2020-09-07 14:16:13 -07:00
Simon Willison
de10590344 recursive_triggers=on by default, closes #152
Refs #149
2020-09-07 13:45:06 -07:00
Simon Willison
e878f2a8fe Applied latest black 2020-09-07 12:45:54 -07:00
Simon Willison
59e3d4d171 Neater indentation for SQL used in schemas, closes #148 2020-09-07 11:12:45 -07:00
Simon Willison
10c6fbc368 Applied Black 20.8b1, refs #142 2020-08-28 15:30:57 -07:00
Simon Wiles
947bb7626f
insert_all(..., alter=True) works for columns introduced after first 100 records
* Insert all columns for every chunk
* Update unit test to reflect new behaviour
* Test that exception is raised
* Update documentation

Closes #139. Thanks, Simon Wiles!
2020-08-28 15:30:13 -07:00
Simon Willison
7e9aad7e1c --load-extension option for sqlite-utils query, closes #134 2020-08-21 13:54:11 -07:00
Simon Willison
bf4c6b7c82 find_spatialite() utility function, closes #135 2020-08-21 13:30:02 -07:00
Simon Willison
2d2d724e32 Tools for enabling and disabling WAL, closes #132 2020-08-10 11:59:21 -07:00
Simon Willison
57e4eb8e55 sqlite-utils populate-fts --tokenize= option, closes #130 2020-08-01 13:51:05 -07:00
Simon Willison
617e6f070c enable_fts(..., tokenize=X) parameter, refs #130 2020-08-01 13:40:36 -07:00
Simon Willison
8fe1e6d1be insert-files can now read from stdin, closes #127 2020-07-29 20:08:12 -07:00
Simon Willison
f804690274 Support inserting UUID and memoryview, closes #128 2020-07-29 18:10:33 -07:00
Simon Willison
ebc802f7ff sqlite-utils insert-files command, closes #122 2020-07-27 00:08:57 -07:00
Simon Willison
1a61a6d3d6 Ability to insert base64 binary data as JSON, closes #126 2020-07-26 20:59:34 -07:00
Simon Willison
814d4a7f90 -p for passing named params to query, closes #124 2020-07-26 20:53:51 -07:00
Simon Willison
20e543e9a4 Output binary columns as base64 in JSON, closes #125 2020-07-26 17:48:36 -07:00
Simon Willison
bc8409941f --raw option, refs #123 2020-07-26 09:43:45 -07:00
Thomas Sibley
ae4593316c Add insert --truncate option
Deletes all rows in the table (if it exists) before inserting new rows.
SQLite doesn't implement a TRUNCATE TABLE statement but does optimize an
unqualified DELETE FROM.

This can be handy if you want to refresh the entire contents of a table
but a) don't have a PK (so can't use --replace), b) don't want the table
to disappear (even briefly) for other connections, and c) have to handle
records that used to exist being deleted.

Ideally the replacement of rows would appear instantaneous to other
connections by putting the DELETE + INSERT in a transaction, but this is
very difficult without breaking other code as the current transaction
handling is inconsistent and non-systematic.  There exists the
possibility for the DELETE to succeed but the INSERT to fail, leaving an
empty table.  This is not much worse, however, than the current
possibility of one chunked INSERT succeeding and being committed while
the next chunked INSERT fails, leaving a partially complete operation.
2020-07-08 10:26:20 -07:00
Thomas Sibley
f8277d0fb9
sqlite-utils query can now run DML (#120)
* Failing test showing that DML in `sqlite-utils query` doesn't work
* Run `sqlite-utils query` in a transaction so that DML is committed

Thanks, @tsibley!
2020-07-07 22:14:04 -07:00
Simon Willison
03ee97d225 CLI now supports upsert/insert - closes #115 2020-06-12 10:40:53 -07:00
Simon Willison
af3f81b540 Store decimal.Decimal in DB as FLOAT, closes #110 2020-05-10 18:50:03 -07:00
Simon Willison
98019e92d0 Ran black, refs #111 2020-05-10 18:26:16 -07:00
Simon Willison
4e9cb739c7 drop-table and drop-view commands, closes #111 2020-05-10 17:44:21 -07:00
Simon Willison
d16097231c Added sqlite-utils create-view command, closes #107 2020-05-03 08:36:29 -07:00
Simon Willison
9f6085b4e4 create-table --ignore and --replace, refs #27 2020-05-03 08:24:39 -07:00
Simon Willison
4d5916075d create-table --not-null, --default, --fk, refs #27 2020-05-03 08:09:00 -07:00
Simon Willison
36d256b047 Initial implementation of create-table command, refs #27 2020-05-02 20:55:40 -07:00
Simon Willison
5c1df4e306 replace=True and ignore=True parameters for create_view(), closes #106 2020-05-02 09:02:04 -07:00
Simon Willison
d56029549a Serialize JSON with non-JSON values, closes #102 2020-05-01 13:45:39 -07:00
Simon Willison
344e9573ca Added sqlite-utils views command, closes #105 2020-05-01 13:38:28 -07:00
Simon Willison
147b52622d sqlite-utils tables ... --schema option, closes #104 2020-05-01 10:12:16 -07:00
Simon Willison
2ab62bcd54 New columns= parameter for over-riding column types, closes #100 2020-04-17 16:53:25 -07:00
Simon Willison
125c625fbc .rows_where(..., order_by=) argument, closes #76 2020-04-15 20:12:55 -07:00
Simon Willison
7e4b9997c2 Database(..., recreate=True) option, refs #97 2020-04-12 20:46:51 -07:00
Simon Willison
635c91475a Only set last_pk on singular .insert()/.update(), refs #98 2020-04-12 20:22:49 -07:00
bob
8ea626e5fc
Add type conversion for Panda's Timestamp (#96)
Thanks, @b0b5h4rp13!
2020-03-30 21:40:48 -07:00
Simon Willison
b436bdb594 Fixed bug with null columns, closes #95 2020-03-23 13:31:06 -07:00
Simon Willison
1c745df923 Suggest column types ignores nulls, closes #94 2020-03-23 12:57:02 -07:00
Simon Willison
1125460497 Improved column type introspection, closes #92 2020-03-14 13:04:06 -07:00
Simon Willison
0c36feb6ca .enable_fts() now works with columns with spaces in them, closes #90 2020-03-01 22:10:43 -08:00
Simon Willison
04ec53c039 Validate column names in more places, refs #86 2020-02-26 20:55:17 -08:00
Simon Willison
f9473ace14 disable-fts and .disable_fts(), closes #88 2020-02-26 20:40:35 -08:00
Simon Willison
b0ca657f49 Disallow square braces in column names, closes #86 2020-02-26 20:16:02 -08:00
Simon Willison
685e6a1bb3 Detect subclasses of dict/tuple/list, fixes #87 2020-02-15 18:20:39 -08:00
Simon Willison
6f3cb2c106 create_index now works with columns with spaces, closes #85 2020-02-10 21:13:15 -08:00
Simon Willison
0eda638d81 table.exists() now a documented method, closes #83 2020-02-08 15:56:03 -08:00
Simon Willison
7c28a4d133 Fix for upsert(hash_id=) bug, closes #84 2020-02-06 23:17:06 -08:00
Simon Willison
de76168be5 Docs for suggest_column_types, closes #81 2020-02-01 13:55:13 -08:00
Simon Willison
5ecf3ffdea Extracted detect_column_types as suggest_column_types, refs #81 2020-02-01 13:38:51 -08:00