Link to home
Start Free TrialLog in
Avatar of jazzIIIlove
jazzIIIloveFlag for Sweden

asked on

merging 2 mysql databases with java

Hi,

I need to merge 2 mysql databases with java or python.

The databases are exactly the same in schema but data is different.

in terms of the query which i need to pass in java or python. Anything i should care about?

Would it be the case that i need to insert data to the table having foreign key first?

what is the strategy?

Br.
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

I don't think there's a 'simple' way to do it. It's just a question of putting the work in
Avatar of jazzIIIlove

ASKER

Hi,

But any approach you suggest?

Br.
You need to issue a series of queries for each and every table
Should i do this e.g
A) Table 2 fk (source): insert into Table 2' fk (target)

B) Table 1 pk (source): insert into Table 1' pk (target)

Should i do in this order (A, B)

Fk: foreign key, Pk: primary key

Prime tables are the tables that will have the merged data
Foreign keys would be a consideration if you are going to get referential integrity violations, yes. In that case, you need to do them in an order that doesn't cause violations
Do you think my above order is correct?
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial