I've been reading up on string formatting, concatenation, etc in Python and ran into an issue. Given a python object, how come this works in SQLite:
for table in tables: query = 'PRAGMA table_info(%s);' % table results = connection.execute(query) . . . but this doesn't:
for table in tables: query = 'PRAGMA table_info({0});'.format(table) results = connection.execute(query) Error for the second version:
database error: near "(": syntax error
print repr(query)give you?print repr(query)shows something like this:u'PRAGMA table_info(<table_name>);'where<table_name>is something likeCars.