Почему закомиченная строка выполняется нормально, а активная строка выдает ошибку?
def add_row():
conn = sqlite3.connect('database2.sqlite')
cursor = conn.cursor()
# cursor.execute("INSERT INTO table1 (id, text_value, num_value) VALUES (7, 'hello', 12)")
cursor.execute("INSERT OR IGNORE INTO {table_name} (id, text_value, num_value) VALUES ({col_id}, {col_text}, {col_num})"\
.format(table_name = 'table1', col_id = 8, col_text = 'fff', col_num = 12))
conn.commit()
conn.close()
add_row()
Traceback (most recent call last):
File "/Users/macmac/python/python and DB/probe2.py", line 45, in <module>
add_row(6, 'hello2', 12)
File "/Users/macmac/python/python and DB/probe2.py", line 40, in add_row
.format(table_name = 'table1', col_id = 8, col_text = 'fff', col_num = 12))
sqlite3.OperationalError: no such column: fff