> >>>>> > >>>>> select_stmt = db.execute("SELECT * FROM people") > >>>>> # use some, but not all of the rows in select_stmt > >>>>> create_stmt = db.execute("CREATE TABLE other (a,b)") # error: > >>>>> database table is locked > >>>>> > >>>>> Why does this happen? > >>>>> > >>>>> Anyway around this? > >>>> > >>>> > >>>> You must finalize select_stmt before running again db.execute > >>> > >>> > >>> Right. I have an instance where I would like to keep the > >> select_stmt > >>> _open_ (or not finalized) while I create a new table. Is > >> this possible? > >> > >> While you are reding the DB, you can't update it, sqlite support many > >> simultaneous readers but only one write; so you can't create > >> a new table > >> while your select statement is running.
but he has only one writer. A select is not a writer, the create statement is. I couldn't get something like this to work either and ended up building a list of updates in memory which I applied after the finalize of the select.