Skip to content
Discussion options

You must be logged in to vote

Yes, this is expected. con.cursor() creates a separate connection to the same database, with its own transaction. It does not join the transaction started by con.begin().

I ran your example on DuckDB 2.0.0 / Python 3.14.7 and got 1, 0, 1: the parent sees its own uncommitted insert, the cursor cannot see it before the parent commits, and its next query sees it after the commit.

There is one extra distinction: your cursor is in autocommit mode. If it explicitly begins a transaction and reads before the parent's commit, further reads keep that earlier snapshot until the cursor ends its transaction. I checked that case too.

For your threaded workflow:

  • If the setup write can be committed sepa…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by evertlammerts
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants