0
def refreshDatabase(table):
    
    c.execute("DROP TABLE ?", (table,))
        
    conn.commit()

    createNewTable(table)

Hey, how can I drop the Table that is declared as a parameter when calling the function? It doesn't seem to work with this syntax. thanks in advance!

1 Answers1

0

Take a look here

You can't substitute table name at SQL side, so change it from Python (which is not safe of course)

def refreshDatabase(table):
    c.execute(f"DROP TABLE {table}")
    conn.commit()
    createNewTable(table)
Alex Kosh
  • 2,206
  • 2
  • 19
  • 18