tst_df = pd.DataFrame({'colA': ['a', 'b', 'c', 'a', 'z', 'q'], 'colB': pd.
    date_range(end=datetime.datetime.now(), periods=6), 'colC': ['a1', 'b2',
    'c3', 'a4', 'z5', 'q6']})
insrt_vals = tst_df.to_dict(orient='records')
engine = sqlalchemy.create_engine(
    'postgresql://user:password@localhost/postgres')
connect = engine.connect()
meta = MetaData(bind=engine)
meta.reflect(bind=engine)
table = meta.tables['tstbl']
insrt_stmnt = insert(table).values(insrt_vals)
do_nothing_stmt = insrt_stmnt.on_conflict_do_nothing(index_elements=['colA',
    'colB'])
results = engine.execute(do_nothing_stmt)
Postgresql НА КОНФЛИКТ в sqlalchemy