Commit Graph

563 Commits (dcb051bcc7fbe0b8c08e24b50760b33fc8c89e76)

Author SHA1 Message Date
voussoir dcb051bcc7
Add dateutil, exifread to list of setup dependencies. 2022-09-07 18:04:42 -07:00
voussoir 6c49d46bc7
Bump to version 0.0.74. 2022-09-03 17:20:27 -07:00
voussoir 7374ffe283
Add pathclass.natural_sorter. 2022-08-21 13:58:44 -07:00
voussoir 2996283344
If given glob pattern is an existing path, just return that. 2022-08-21 13:57:19 -07:00
voussoir 6b26a4bd93
Add method explain which shows explain query plan. 2022-08-21 13:54:44 -07:00
voussoir 1fe6de793c
Update worms to match sqlhelpers. 2022-08-13 07:24:31 -07:00
voussoir 54fa46c4f9
Use named column inserts, but remove require_all parameter.
I am yet again bumping into the limits of extract_table_column_map
as it does not use a real parser and does not recognize generated
columns, which causes issues when I use that column list to enforce
an insert.

It probably would be better to move even farther away from extracting
columns and just asking the database instead.

Anyway we get slightly improved ergonomics of insert_filler at the cost
of not being able to enforce all columns within this function.
2022-08-13 07:23:53 -07:00
voussoir 353cba7dfd
Use exifread for paths, pil for existing image objects.
Instead of using pil all the time.
2022-08-03 18:43:17 -07:00
voussoir 720a2bebcf
Officially prefer int for IDs.
For a while I was attracted to string IDs because of the notion
that "if you're not going to perform arithmetic, it shouldn't be
an int". But ints make way better use of the allotted bits and
I'm loving getrandbits for urandom ID generation.
2022-07-17 19:48:17 -07:00
voussoir cbef38ba7f
Add new transaction locking and cleaner atomicity in worms.
This change has really made it easier to reason about database
transactions in my projects. When you use 'with db.transaction'
you know for sure that either the db will commit or rollback at
the end and you won't leave in a dirty state. And it will lock
out all other writers so nothing gets messed up.

Previously I was conflating atomicity of each function with
committing of the entire transaction, and that was causing me
grief. I think this is closer to correct.
2022-07-17 19:48:17 -07:00
voussoir abfaf27cee
Add exifread function. 2022-07-17 19:48:17 -07:00
voussoir 3dd270bb4a
Add method exists. 2022-07-17 19:48:16 -07:00
voussoir 18de52ecb7
Bandaid fix for no content-length header.
This worked fine before and then I messed it up but I'm
not in the mood to go back and look at the old code.
2022-07-17 19:48:16 -07:00
voussoir c32f89da7d
Use dateutil.parser instead of specific strptime. 2022-07-17 19:48:16 -07:00
voussoir 7a60f23ebf
Add function get_exif_datetime. 2022-06-23 11:26:40 -07:00
voussoir aeb6b89f58
Add parameter fallback to select_one_value. 2022-06-03 19:42:20 -07:00
voussoir 2c8081505a
Buffer the exif in a bytesio to save from fp being closed. 2022-05-07 10:31:31 -07:00
voussoir 7f2360d1c0
Distinguish between symlinks and ntfs junctions. 2022-04-30 07:23:51 -07:00
voussoir cb84774231
Rearrange some asserts. 2022-04-30 07:23:02 -07:00
voussoir fa78fa3b9d
Add global ARGV_LEVEL for runtime use. 2022-04-30 07:22:18 -07:00
voussoir 19f69473c8
Add AppendAction to store_types. 2022-04-30 07:21:57 -07:00
voussoir 306ddf489c
Change variable name for clarity, strip out comment lines. 2022-03-28 14:18:43 -07:00
voussoir e487188617
Bump to version 0.0.73. 2022-03-26 13:19:20 -07:00
voussoir 6204572195
Update copyright year. 2022-03-26 13:18:27 -07:00
voussoir 59b0916f88
Add more information when logging at DEBUG, LOUD. 2022-03-24 15:35:40 -07:00
voussoir 36e4a44bfb
Filter out comment lines beginning with --. 2022-03-23 23:08:43 -07:00
voussoir 956b3c6053
Handle the case in which colorama is not installed. 2022-03-23 14:38:15 -07:00
voussoir 5ddc83e3ff
Call expanduser in pathclass init. 2022-03-23 14:37:04 -07:00
voussoir 1026d4414c
Add a calling card to @transaction for runtime determination. 2022-03-22 22:17:32 -07:00
voussoir 9c9123e2d2
Update type annotation, savepoint_id is an int. 2022-03-22 22:16:42 -07:00
voussoir a76982e581
Add type annotation sqlite3.Cursor. 2022-03-22 22:16:26 -07:00
voussoir 6da730e5a6
Add worms.id_type to improve behavior of int ids.
If the project uses numerical IDs, and processes user input from a web
request URL where everything is a string, it is tedious to convert
between str and int on the application side. If done improperly, it
messes up the cache because the int id and str id will be entered
separately. So we let the database handle the id type and raise errors
if necessary.
2022-03-21 19:41:59 -07:00
voussoir 8f2b0ebc6a
Add sqlhelpers.Inject. 2022-03-20 13:04:28 -07:00
voussoir 629594b6ae
Add SSE functions. 2022-03-20 13:01:26 -07:00
voussoir f79fcf6432
Improve flasktools.cached_endpoint.
- Store separate states for different url and param permutations.
- Add the etag_function which allows you to decide not to run the
  function in the first place, instead of running it and seeing
  that its return value matches the previous value.
2022-03-20 13:00:46 -07:00
voussoir 4b0d50c193
Add isinstance check for sqlite3.Row. 2022-03-19 20:03:50 -07:00
voussoir 465f22fedb
Instead of checking get_tables, just check the COLUMN_INDEX.
This reduces the number of frivolous sql queries we make, since
the index contians all the tables anyway. The side effect is that
the function won't acknowledge tables created during the run time,
which I kind of think is a good thing since it reduces accident
surface area to the tables outlined by the programmer during init.
2022-03-19 20:03:26 -07:00
voussoir 59df12a23f
Simplify worms.get_tables with select_column. 2022-03-19 19:51:25 -07:00
voussoir 6867fb3011
Remove normalize_db_row, just use row_factory = Row. 2022-03-15 18:17:23 -07:00
voussoir ac647a37a8
Let comma_space_split return empty list if string is all blank. 2022-03-15 13:37:57 -07:00
voussoir 5f5f41885e
Move get_tables into alphabetical order. 2022-03-15 13:37:28 -07:00
voussoir 05b009a7c6
Escape backslashes when stringifying. 2022-03-15 13:29:14 -07:00
voussoir ee4914fa63
Add self.last_commit_id to help application know state of the world.
This allows caching layers to make better decisions about when to
reload data.
2022-03-14 15:37:46 -07:00
voussoir 9b2ad4d027
Let delete, insert, update return the self.execute return value. 2022-03-14 15:35:51 -07:00
voussoir 512f1591ef
Add select_one_value. 2022-03-14 15:34:41 -07:00
voussoir 38f9d8046c
Add worms.raise_without_rollback. 2022-03-14 15:32:11 -07:00
voussoir 0fd09984bc
Let object tokens repr themselves in the diagram. 2022-03-14 15:30:46 -07:00
voussoir ed952ffdda
Use getrandbits instead of passwordy strings for savepoint ids.
Better perf, why not.
2022-03-10 11:55:07 -08:00
voussoir d17a79c128
Store into cache using instance.id instead of requested id.
This helps ensure that the keys of the cache are the true and correct
data type and not just whatever the user provided. SQLite coerces
strings and ints.
2022-03-10 11:24:52 -08:00
voussoir c7f4d1dbf9
Respect the user's NO_COLOR environment variable. 2022-03-10 11:19:36 -08:00