Domanda

I'm attempiting to use cx_OracleTool's CopyData.py script to copy data between two tables on separate Oracle schemas/instances:

http://cx-oracletools.sourceforge.net/cx_OracleTools.html

When I run it against my tables, I get the error:

No primary or unique constraint found on table.

I don't know much about Oracle, to be honest, but from what I can tell the tables don't seem to have any PK constraint or anything like that defined.

The merits of this aside, I think it's simply been setup that way for expediency, and it's unlikely to change anytime nearterm.

Is there any way to get copyData.py to run in this scenario without a PK constraint?

Cheers, Victor

È stato utile?

Soluzione

The issue is that CopyData checks to see if the row exists in the destination table, and it can't do that without a unique key.

If it is acceptable to insert all rows and not update changed ones, use the --no-check-exists option. According to the code this will bypass the primary key check.

Otherwise, use the --key-columns=COLS option to manually specify the columns to be used as the unique key. This will also bypass the primary key check.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top