4

I have a table in MySql in one server and a table in PostgreSQL in another server. I want use use JOIN operation with those tables. Is there any way to join the columns? If not, is there any way to print the rows in same order? Please help!!

5

3 Answers 3

5

Use mysql_fdw to define the MySQL table as a foreign table in PostgreSQL. Then you can join it with the PostgreSQL table in PostgreSQL.

Sign up to request clarification or add additional context in comments.

Comments

2

You can use Materialize to achieve this.

Here is a sample demo project that you can run to see this in action:

enter image description here

You can find the code for the demo project and how to run it on GitHub here:

https://github.com/bobbyiliev/materialize-tutorials/tree/main/mz-join-mysql-and-postgresql

Comments

1

Hope this reference helps.

Yes, it is possible to work with multiple databases at the same time but you're looking in the wrong place. psycopg2 is just a library that simplifies accessing and manipulating data coming out of PostgreSQL but it doesn't go far beyond what you can do with psql. What you're looking to do you can solve on the database level by using Foreign Data Wrappers.

This does become more complicated in your schema definition but brings remote tables from host some.other.server database remote_db to appear as though they live on localhost in database local_db.... More: https://dba.stackexchange.com/a/120682/197899

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.