About EasyMorph Tutorials & Examples Web-help

Is 1 export to database action = 1 session?

Hi,

I want to disable foreign keys in postgres prior to export. This seems to be possible with

set session_replication_role = replica;

So when I set this in the option op database export action like depicted below, does the session_replication_role parameter be reset to default when export to database action has run ?

Hi Nikolaas,

Yes, each “Export to database” action will start its own session.

Changing this option will only affect the corresponding “Export to database” action.

Andrew,

Thanks. I have been experimenting. One additional question.
I have now a statement to first disable a foreign key (drop it) and then add it back.

In the export to database action, the SQL-option is called “SQL BEFORE exporting”.
The last line of SQL in that window is a statement to add the foreign key back to the table from which it was removed. Will it actual be put back because from the option description, the statement is executed before exporting the rows ?

See example below. Will this correctly put the foreign key back or do I need to split part shown beside de blue line in a separate database command action?

If you want to put back the foreign key before the export, you should leave it as is.

If you want to put it back after the export, you should move it to a separate “Database command” action.

Hi Andrew,

Thanks for your useful input !

To learn more about EasyMorph visit easymorph.com.