I have a sqlite database which using the below I am able to successfully check if a table exists.
conn = sqlite3.connect('test.db) c = conn.cursor() c.execute('''SELECT count(name) FROM sqlite_master WHERE type='table' AND name = 'March' ''' However as soon as I introduce a variable into this code:
c.execute('''SELECT count(name) FROM sqlite_master WHERE type='table' AND name={} '''.format('March') I get the below error:
c.execute('''SELECT count(name) FROM sqlite_master WHERE type='table' AND name={}'''.format('March')) sqlite3.OperationalError: no such column: March Is there a better way of doing this or am I missing something?