@db_connect
def f(cursor):
cursor.execute("""INSERT INTO messages (sender_first_name, sender_id, sender_username, message_id, message_text, chat_title, chat_id, chat_username, parser_first_name, parser_id, parser_username, parser_phone_number, got_time) SELECT sender_first_name, sender_id, sender_username, message_id, message_text, chat_title, chat_id, chat_username, parser_first_name, parser_id, parser_username, parser_phone_number, got_time ON CONFLICT (message_id, chat_id) DO NOTHING FROM allmessages WHERE message_text LIKE '%ищу менеджер%' OR message_text LIKE '%ищу помощник%' OR message_text LIKE '%ищу специалист%' OR message_text LIKE '%нужен менеджер%' OR message_text LIKE '%нужен помощник%' OR message_text LIKE '%нужен специалист%' OR message_text LIKE '%Ищу менеджер%' OR message_text LIKE '%Ищу помощник%' OR message_text LIKE '%Ищу специалист%' OR message_text LIKE '%Нужен менеджер%' OR message_text LIKE '%Нужен помощник%' OR message_text LIKE '%Нужен специалист%';""")
f()