Simon Willison
8dab9fd1cc
insert_all() / .upsert_all() work with empty list ( #64 )
...
Closes #52
2019-11-06 20:32:37 -08:00
Simon Willison
a0a65f9a64
Release 1.12
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
eb39c84a8f
Test and docs for using :memory: as a filename
2019-10-04 09:17:27 -07:00
Simon Willison
d5e1f8ac77
Release 1.11
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
Amjith Ramanujam
405e092d59
Option to add triggers when enabling FTS ( #57 )
...
--create-triggers CLI option and create_triggers=True in the Python library
* Add an option to create triggers for fts table.
* Add cli option for the create-update-trigger.
* Add tests for the create-update-trigger option.
* Change FTS table escaping to square brackets.
2019-09-02 16:42:28 -07:00
Simon Willison
cb70f7d109
Corrected .views_names() -> .view_names()
2019-08-26 07:04:14 +02:00
Simon Willison
68a5cb1b8e
Corrected .table_views() -> .view_names()
2019-08-26 07:03:22 +02:00
Simon Willison
53124bc02f
Release 1.10
1.10
2019-08-23 15:24:04 +03:00
Simon Willison
9faa982226
Ability to introspect and run queries against views ( #55 )
...
* db.views_names() method and and db.views property
* Separate View and Table classes, both subclassing new Queryable class
* view.drop() method
* Updated documentation
2019-08-23 15:19:41 +03:00
Simon Willison
0e7b461eb3
Fixed typo
2019-08-04 07:13:31 +03:00
Simon Willison
6ac0a5df5d
Release 1.9
1.9
2019-08-04 06:35:30 +03:00
Simon Willison
4c0912dbf2
table.m2m() method for creating many-to-many records
...
Closes #23
2019-08-04 06:37:32 +03:00
Simon Willison
243bcaa1ac
Documentation for .m2m() table method
2019-08-04 05:29:19 +03:00
Simon Willison
5516175ca6
Allow table objects to be passed to .m2m()
2019-08-04 05:09:17 +03:00
Simon Willison
d96a8f149e
Use existing m2m table if one exists
2019-08-03 21:16:51 +03:00
Simon Willison
b9256413d2
db.m2m_table_candidates(table, other_table)
2019-08-03 21:07:06 +03:00
Simon Willison
b6b92980c0
table.m2m(..., m2m_table=x) argument
2019-08-03 20:51:22 +03:00
Simon Willison
ba1211d445
Implemented .m2m(table, lookup=...)
2019-08-03 17:28:03 +03:00
Simon Willison
ff2348e71a
Added failing tests
2019-07-31 09:16:46 +03:00
Simon Willison
35eeafaaa3
table.m2m(...) method, with tests
2019-07-31 08:51:50 +03:00
Simon Willison
e1021030dd
Release 1.8
1.8
2019-07-28 18:41:42 +03:00
Simon Willison
0747dabb24
table.update() method
...
* Also now set .last_pk to lastrowid for rowid tables
* table.pks introspection now returns ["rowid"] for rowid tables
Closes #35
2019-07-28 18:43:50 +03:00
Simon Willison
16d7008002
Applied black
2019-07-28 18:37:27 +03:00
Simon Willison
5986083746
Documentation for table.update() method
2019-07-28 18:03:44 +03:00
Simon Willison
bc9c4db34b
.update(...) with no update argument sets last_pk
2019-07-28 17:59:52 +03:00
Simon Willison
4ab8d46b03
Added table.update(pk, ..., alter=True)
2019-07-28 17:51:49 +03:00
Simon Willison
5225dbb89c
Unit tests for invalid .update() pks
2019-07-28 17:46:49 +03:00
Simon Willison
e4a11b1815
Refactor .update() to use .get()
...
.pks introspection now returns [rowid] for rowid tables.
2019-07-28 15:44:33 +03:00
Simon Willison
455071f3c5
Unit tests for .update()
...
Also now set .last_pk to lastrowid for rowid tables.
2019-07-28 15:30:28 +03:00
Simon Willison
15368c5f59
First working version of .update(), refs #35
2019-07-28 15:15:50 +03:00
Simon Willison
a6749cdf43
Release 1.7.1
1.7.1
2019-07-28 15:00:51 +03:00
Simon Willison
535a5ea476
Documentation and tests for table.drop() method
2019-07-28 14:57:02 +03:00
Simon Willison
9cb045284e
Fix for too many SQL variables on bulk insert
...
SQLite has a max of 999 variables per query, so bulk inserts of e.g. 100 records with 11 columns each were failing with an error.
We now dynamically adjust the batch_size to ensure this doesn't happen.
Closes #50
2019-07-28 14:59:32 +03:00
Simon Willison
0c1b8b7f96
Use assertion to enforce <=999 columns
2019-07-28 14:41:57 +03:00
Simon Willison
62d2922528
Fix for too many SQL variables, closes #50
2019-07-28 14:10:56 +03:00
Simon Willison
9b7be79c86
Release 1.7 - with lookup table support
1.7
2019-07-24 08:50:41 +02:00
Simon Willison
941d281aee
extracts= table parameter, closes #46
2019-07-23 10:00:42 -07:00
Simon Willison
e22cfcd953
Removed a TODO which is now done
2019-07-23 15:05:04 +02:00
Simon Willison
5805024316
Implemented table.lookup(...), closes #44
...
* Add pk column if missing from insert
* Implemented table.lookup(...)
2019-07-23 06:06:59 -07:00
Simon Willison
f3a4c3d3ee
db.create_table() now remembers configs
2019-07-23 09:47:19 +02:00
Simon Willison
535a731b93
Fixed lint error
2019-07-23 09:41:34 +02:00
Simon Willison
034d498b31
Support Database(memory=True) for in-memory databases
2019-07-22 17:12:54 -07:00
Simon Willison
58db40d67c
Better __repr__ for tables
2019-07-22 17:05:51 -07:00
Simon Willison
127a836054
Documented new table configuration options via .table()
2019-07-22 16:59:17 -07:00
Simon Willison
be655827b4
use_table_factory is a better name than use_class_constructor
2019-07-22 16:33:37 -07:00
Simon Willison
57e43baece
Table options can now be passed to constructor OR to insert_all()
...
If you want to set default options for a table, you can do this:
table = db.table("dogs", pk="id", column_order=["name", "age"])
If you pass those keyword arguments to the .insert/.update/etc
methods they will over-ride the defaults you set on the table.
table = db["dogs"] # This still works too
2019-07-22 16:30:54 -07:00