I have question about python and sqlite3. I want to drop a table from within Python. The command
cur.execute('drop table if exists tab1')
Does not work.
cur.executescript('drop table if exists tab1;')
does the job.
The execute method allows the creation of tables. However, it won't drop them? Is there a reason for this?
The cur.executescript
command issues a COMMIT
before running the provided script. Additionally a CREATE
executes a COMMIT
intrinsically. Perhaps you have an open transaction that needs committed before your changes take place.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With