samedi 28 novembre 2015

SQLite3 - syntax error near '?' [duplicate]

This question already has an answer here:

I'm trying to create a table using placeholder but it seems that there is some mistake. I can't figure out what's the actual problem.

def create_table_if_not_exists(self,subject):
        self.cur.execute(
            """CREATE TABLE IF NOT EXISTS ?(`id` TEXT)""",(subject,))
        self.conn.commit()

self.cur.execute("""CREATE TABLE IF NOT EXISTS ? (id TEXT)""",(subject,)) sqlite3.OperationalError: near "?": syntax error

Do you know what causes the syntax error?

Aucun commentaire:

Enregistrer un commentaire