Commit graph

288 commits

Author SHA1 Message Date
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
Simon Willison
152eb2afaf Use pysqlite3 if available 2019-07-22 15:39:35 -07:00
Simon Willison
c88f0a4d46 Release 1.6 1.6 2019-07-18 21:51:21 -07:00
Simon Willison
09316835e6 Implemented --tsv option, closes #41 2019-07-18 21:50:38 -07:00
Simon Willison
ef112ffc94 Release 1.5 1.5 2019-07-14 21:37:31 -07:00
Simon Willison
c65b67ca46
.get() method plus support for compound primary keys (#40)
* create_table now handles compound primary keys
* CLI now accepts multiple --pk for compound primary keys
* Docs for compound primary keys with CLI and Python library
* New .get() method plus documentation

Closes #36, closes #39
2019-07-14 21:28:51 -07:00
Simon Willison
65b2156d9c Show version in docs
Thanks, @nedbat

https://twitter.com/nedbat/status/1150490436114534400
2019-07-14 12:45:00 -07:00
Simon Willison
91311bb0db Sphinx docs now pull version info from git tag
Based on http://dreamiurg.net/2011/10/03/using-git-to-get-version-information/
2019-07-14 12:24:45 -07:00
Simon Willison
a8ecf95f11 Use pip install -e .[docs] for documentation dependencies 2019-07-14 12:23:31 -07:00
Simon Willison
f70e35c9bb Added table.rows_where(where, args) method 2019-07-14 11:58:40 -07:00
Simon Willison
72a6f430df Update PyPI classifiers 2019-07-14 10:16:36 -07:00
Simon Willison
41d1751aec Release 1.4.1 1.4.1 2019-07-14 10:08:34 -07:00
Simon Willison
ba6bd47f15 Typo fix 2019-07-14 09:25:57 -07:00
Simon Willison
fef96163d9
Minor markup cleanup 2019-07-09 04:55:04 -07:00
Simon Willison
5be66529a3
Fixed RST and Typo 2019-07-09 04:49:32 -07:00
Simon Willison
b0a2f897f4
Typo fix 2019-07-09 04:42:40 -07:00
Simon Willison
1a053d9438
Added Python library example to README 2019-07-03 11:04:03 -07:00
Simon Willison
fad14ab943 Release 1.4 1.4 2019-06-30 16:51:17 -07:00
Simon Willison
e8f887ef4a
sqlite-utils index-foreign-keys / db.index_foreign_keys()
Closes #33
2019-06-30 16:50:54 -07:00
Simon Willison
0fe3b38290
Added db-to-sqlite to "Related projects" 2019-06-29 14:34:24 -07:00
Simon Willison
b4e36546b0 Release 1.3 1.3 2019-06-28 23:32:36 -07:00
Simon Willison
997d8758fc
db.add_foreign_keys() method
Closes #31
2019-06-28 23:27:38 -07:00
Simon Willison
86bd2bba68 1.2.2 release notes 2019-06-25 21:23:45 -07:00
Simon Willison
641eccc2b7 Release 1.2.2 1.2.2 2019-06-25 21:20:55 -07:00
Simon Willison
f03d2eddd8 Handle datetime.time correctly 2019-06-25 21:18:35 -07:00
Simon Willison
46281c9db0 Release 1.2.1 1.2.1 2019-06-20 17:01:24 -07:00