Bump version number for dev
Added tag v0.0.1-release for changeset f5a1edfc68d4
Bump version number for release
Mark changelog with release date for v0.0.1
create Generated objects from any callable objects passed to Insertable
make update return the updated row values
add a readme
fix linter errors
rewrite update logic to use savepoints This fixes the case where we use rollback() to revert the effect of the update. It fails with Insertable(...).after() because there is both an insert and an update in the same transaction, eg:: Insertable("foo", x=1).after(x=2) This causes the following queries: INSERT INTO foo (x) VALUES (1) SELECT * FROM foo WHERE x=1 -- Grab save values for update UPDATE foo SET x=2 WHERE x=1 ROLLBACK -- rolls back the UPDATE but also the INSERT SELECT * FROM foo WHERE x=1 -- sanity check we have original values back The final sanity-check SELECT returns no rows (because the insert has also been rolled back), so the following assertion will fail. The solution is to use savepoints so that the UPDATE can be rolled back independently of the INSERT.
add Generated values
implement Insertable.after()
rename 'delete' flag to 'revert' so that it can be applied to update too
rewrite reference handling
resolve relations in inserted data at the end of the process This avoids any possibility of KeyErrors
dry up Reference copying
ensure that copying an Insertable also copies any children
resolve references only at insertion time This means that references can be copied between objects and still resolve correctly, eg:: user = Insertable("user", order=Insertable("orders", user_id=PARENT.id)) my_user = user(name="foo") Before this change the PARENT reference inside orders would have been resolved during object construction to ``user.id``. So when my_user is created the order row would not point to my_user.id and it would fail.
handle child attributes which are lists of Insertables
add PARENT symbol as shortcut for SELF._parent
allow child Insertables to count as resolved; care only about relationships In a one-to-many relationship, insertable children shouldn't block the parent from being created. So this: Insertable( "users", name="alice", orders=[Insertable("orders", user_id=SELF._parent.id)] ) Should generate something like this: INSERT INTO users ... RETURNING id; INSERT INTO orders (user_id) VALUES (:id); We can do some magic later to link the child row back to its parent.