79573139

Date: 2025-04-14 12:29:18
Score: 1
Natty:
Report link

Thanks for @ThomA!

The solution is using method add with Session like:

with Session(autoflush=False, bind=engine_new) as db:

                new_part = Parts(                    
                    part_kod=dataArt.get('kod'),
                    part_description=dataArt.get('title'),
                    part_kod_supplier=dataArt.get('supplier'),
                    part_manufacturer=manId
                )

                db.add(new_part)
                db.commit()

While using

rowInsertStmt = insert(partsTable).values(...)
#or this rowInsertStmt = partsTable.insert().values(...)
session_new.execute(rowInsertStmt)
session_new.commit()

You will see an error in the topic.

I use the same solution with 'insert' for processing 'manufactures' and it works well, but with one sql trigger.

Reasons:
  • Blacklisted phrase (0.5): Thanks
  • Whitelisted phrase (-1): solution is
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @ThomA
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Stanislav