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.
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.
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.
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.
- 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.
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.