Commit graph

147 commits

Author SHA1 Message Date
Simon Willison
0ca5585fcb Clarify why you would want transform_sql() 2020-09-23 13:16:01 -07:00
Simon Willison
1ebffe1dbe Correction: SQLite ALTER TABLE can rename columns 2020-09-22 20:09:42 -07:00
Simon Willison
71782311ce New .rows_where(select=) argument 2020-09-22 16:10:14 -07:00
Simon Willison
c3210f2ffb Added table.extract(rename=) option, refs #42 2020-09-22 15:57:02 -07:00
Simon Willison
f8553799d3 table.extract() method, refs #42 2020-09-22 15:20:18 -07:00
Simon Willison
f8e10df00e
Keyword only arguments for transform()
Also renamed columns= to types=

Closes #165
2020-09-21 23:39:10 -07:00
Simon Willison
987dd123f2
table.transform() method - closes #114 2020-09-21 21:20:01 -07:00
Simon Willison
482477585a @db.register_function decorator, closes #162 2020-09-21 17:31:43 -07:00
Simon Willison
e23eedb4ce ignore=True argument for add_foreign_key, closes #112
Also --ignore for add-foreign-key command

Plus table.add_foreign_key(...) now returns self, allowing more chaining
2020-09-20 15:17:25 -07:00
Simon Willison
ecb50c8f76 .enable_fts(..., replace=True) argument, closes #160 2020-09-20 15:05:46 -07:00
Tom V
7805d53bcf
Fix accidental mega long line in docs (#158)
Thanks @tomviner
2020-09-15 23:21:42 -07:00
Simon Willison
32f1badfec Tracer example using print, refs #150 2020-09-08 16:27:55 -07:00
Simon Willison
176f4e0ef4 sqlite-utils rebuild-fts command, closes #155 2020-09-08 16:16:03 -07:00
Simon Willison
64799df78b .optimize() no longer cleans up _docsize
This isn't necessary any more since the new .rebuild_fts()
method can achieve the same thing.

Refs #155, #153
2020-09-08 15:18:12 -07:00
Simon Willison
4c0f79398f table.rebuild_fts() method, refs #155 2020-09-08 15:09:25 -07:00
Simon Willison
cf2cb244fa
Tracer mechanism for showing underlying SQL queries
* Pass a tracer= function to Database constructor
* New db.tracer() contextmanager
* Neater SQL indentation, because tracer means it could be visible now
* New db.execute() and db.executescript() methods

Closes #150
2020-09-07 14:56:59 -07:00
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
0e62744da9
Correct import path for AlterError exception 2020-09-02 13:29:46 -07:00
Simon Willison
e0cd430e89
Docs for sqlite_utils.AlterError in add_foreign_keys() 2020-09-02 13:17:01 -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
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
db1e08c2c8
Documentation for table.detect_fts() method 2020-08-05 19:21:49 -07:00
Simon Willison
5560d717cb
Updated list of supported parameters to db.table() 2020-08-01 14:30:43 -07:00
Simon Willison
617e6f070c enable_fts(..., tokenize=X) parameter, refs #130 2020-08-01 13:40:36 -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
Simon Willison
fbeb61e49c
Documentation for table.pks, closes #116 2020-06-23 14:03:13 -07:00
Simon Willison
78264b738c Removed docs for feature I decided not to implement, refs #27 2020-05-03 08:25:21 -07:00
Simon Willison
9f6085b4e4 create-table --ignore and --replace, refs #27 2020-05-03 08:24:39 -07:00
Simon Willison
79541d3a6d Release 2.7.2, refs #106 2020-05-02 09:05:27 -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
2ab62bcd54 New columns= parameter for over-riding column types, closes #100 2020-04-17 16:53:25 -07:00
Simon Willison
31d3df0f79
Typo fix 2020-04-16 15:21:40 -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
43f1c6ab4e
Documentation for NotFoundError 2020-03-06 15:08:21 -06:00
Simon Willison
f9473ace14 disable-fts and .disable_fts(), closes #88 2020-02-26 20:40:35 -08:00
Simon Willison
0eda638d81 table.exists() now a documented method, closes #83 2020-02-08 15:56:03 -08:00
Simon Willison
de76168be5 Docs for suggest_column_types, closes #81 2020-02-01 13:55:13 -08:00
Simon Willison
e8b2b7383b
New conversions= feature, closes #77
Pull request: #78
2020-01-30 16:24:30 -08:00
Simon Willison
9f47e8b9a4 Documentation for new upsert v.s insert-replace
Refs #66
2019-12-30 05:29:23 +00:00
Simon Willison
9262c3e7c0
Corrected Database(memory=True) documentation 2019-12-18 09:00:36 +00:00
Simon Willison
a0a65f9a64 Release 1.12 2019-11-04 08:28:52 -08:00
Simon Willison
169ea455fc Added table.delete_where(), closes #62 2019-11-04 08:18:06 -08:00
Simon Willison
19073d6d97 Added table.delete(pk) method, refs #62 2019-11-04 08:08:01 -08:00
Simon Willison
d5e1f8ac77 Release 1.11 2019-09-02 17:58:41 -07:00
Simon Willison
3a4dddaca2 Documentation for create-triggers, refs #57 2019-09-02 17:10:26 -07:00
Simon Willison
2ca63e3b2d
db.triggers and table.triggers introspection (#60)
Closes #59
2019-09-02 17:09:41 -07:00
Simon Willison
68a5cb1b8e
Corrected .table_views() -> .view_names() 2019-08-26 07:03:22 +02:00