You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This might totally be an operator error but it surprised me and took some tracking down to figure out what was wrong. I searched docs for "commit" but maybe not very hard
I'm playing around a datasette project and using a mixture of sqlite-utils (v3.37) functions like .upsert(), .query(), and .execute()
All is good. Fun framework. Thanks for it
However, I recently swapped an .upsert() for an .execute() so that the .execute() was the last action before the application exits. This meant that the writes in the execute were not committed. Here's a simple script that shows the issue...
$ python simple-case.py
$ sqlite-utils query test.db "select * from artist_details"# check contents of table, it will show an empty array
If I change either of those Falses to True then the transactions are committed and everything works as expected.
Easy enough to workaround, but like I say, a little surprising.
The text was updated successfully, but these errors were encountered:
jammus
changed the title
Execute statements not committed until a utlity function is ran
Execute statements not committed unless a utlity function is ran
Oct 6, 2024
Other things that work include the with database.conn: trick from the .delete_where example, or setting database.conn.isolation_level = None at the start of the script
Hello,
This might totally be an operator error but it surprised me and took some tracking down to figure out what was wrong. I searched docs for "commit" but maybe not very hard
I'm playing around a datasette project and using a mixture of sqlite-utils (v3.37) functions like .upsert(), .query(), and .execute()
All is good. Fun framework. Thanks for it
However, I recently swapped an .upsert() for an .execute() so that the .execute() was the last action before the application exits. This meant that the writes in the execute were not committed. Here's a simple script that shows the issue...
Run the script with:
If I change either of those
False
s toTrue
then the transactions are committed and everything works as expected.Easy enough to workaround, but like I say, a little surprising.
The text was updated successfully, but these errors were encountered: