Skip to navigation
Check if a sqlite3 table exist with python
21.11.19
example with insert db = sqlite3.connect('foo.db) c = db.cursor() c.execute(''' SELECT count(name) FROM sqlite_master WHERE type='table' AND name='eta' ''') if not c.fetchone()[0]: c.execute(''' CREATE TABLE eta (eta REAL) ''') c.execute("""INSERT INTO eta VALUES ({0})""".format(process_time)) db.commit() db.close()
https://pythonexamples.org/python-sqlite3-check-if-table-exists/
Reply
Anonymous
Information Epoch 1752304025
Using text data files.
Home
Notebook
Contact us