Пытаюсь передать данные с разных таблиц одной БД SQlite. Данные с первой таблиц "dic_Monitorе" передаются, а вот данне со второй таблице "dic_memory" проблема
Ошибка
LINE 1: INSERT into dic_memory(displname, assetname) VALUES ('1 ГБ D..
Где накосячил?
# Проверка, нужно ли использовать ID для выборки данных
if 'use_id' in cfg["sqlite"] and cfg["sqlite"]['use_id']:
use_id_filter = True
pg_id_cursor = connection_destination.cursor()
pg_id_cursor.execute('select id from ' + table_name + ' order by id desc')
row = pg_id_cursor.fetchone()
if row is not None:
skip_id = row[0]
pg_id_cursor.close()
query = 'select ' + columns + ' from ' + table_name
if use_id_filter:
query += ' where id>' + str(skip_id)
query += ' order by id'
connection_source = sqlite3.connect(cfg["sqlite"]['path'])
cursor = connection_source.cursor()
cursor.execute(query)
field_names = [i[0] for i in cursor.description]
row = cursor.fetchone()
while row is not None:
pgcursor = connection_destination.cursor()
params = []
import re
params_placeholders = re.sub(r"[A-Za-z0-9_]+", "%s", columns)
for column in columns.split(', '):
params.append(row[field_names.index(column)])
pgcursor.execute(
"INSERT into " + table_name + "(" + columns + ") VALUES (" + params_placeholders + ")",
params)
row = cursor.fetchone()
connection_destination.commit()
cursor.close()