class int_db:
def __init__(self, _id: str):
self.conn = sqlite3.connect("int_db.db", isolation_level=None)
self.cur = self.conn.cursor()
sql_cmd = '''CREATE TABLE {}(name)'''.format(
_id)
self.cur.execute(sql_cmd)
def insert_db(self, _id, name: str):
sql_cmd = '''INSERT INTO {} VALUES ({})'''.format(_id, name)
self.cur.execute(sql_cmd)
self.conn.commit()
self.conn.close()
the _id is value of "1241448952" how can I success this?
I want to make a table named by variable.
error:
sqlite3.OperationalError: near "1241448952": syntax error