Migrate Data from MongoDB to Postgres - postgresql

We have database in mongo for a long time and now we have decided to move to Postgres. Since these two are totally different we have started with table design and API migration first. Now it comes to the data part.
In mongo, we have the following schemas and we wanted to migrate the same data to Postgres. I have gone through a couple of articles that say you can export data from mongo in CSV and import in Postgres using COPY command or using pgAdmin.
Mongos used uuid which is basically a string but in postgres we have id as an integer. we have used crossed ref foreign key in mongo as well how we can migrate those without lossing the connection between tabeles ?
can anyone suggest any good method ?

Related

Recreate SQL Commands from db

I have created a db long ago using django. Now as we are migrating the application, so I need all the CREATE TABLE sql queries which django might have run to create the entire db for our service (which has around 70-80 tables and each table has avg 30-70 columns).
Both the servers old and new are using Postgres for databases.
But the technology stack is completely different (A 3rd party proprietary application which will host the service) instead of django.
If I start to write all the tables again from scratch, it will take at least a week or two.
Is there any way either from Postgres or from django which can generate the CREATE TABLE sql schema for an entire db keeping all the relationship as is?
Also, I have to do minor modification to that schema as per customer requirement.
p.s - pg_dump won't work as I need actual schema itself to get it reviewed from client.

Data Migration from one DB to another

I have to create an app which transfer data from snowflake to postgres everyday. Some tables in postgres are truncated before migration and all data from corresponding snowflake table is copied. While for other tables, data after last timestamp in postgres is copied from snowflake.
This job has to run at night sometime and not when customers are using the service at daytime.
What is the best way to do this ?
Do you have constraints, limiting your choices in:
ETL or bulk data tooling
Development languages?
According to this site, you can create a foreign data wrapper on Postgresql for snowflake

Importing data from MS Access db to PostgreSQL db

I have a table in an MS Access db that I want to export to a PostgreSQL database. Every 2 or so months, I want to move all records from the Access table to a table in Postgres.
Right now, I am using the Export to ODBC option in Access to do this, but every time it exports as an entirely new table in Postgres. Is there a way for me to routinely append the records in the Access table to an existing table in my Postgres database? I have come across the option of a FDW but I am not familiar with how to install/use it.
I am new to using PostgreSQL, and have little to no experience working with databases other than Access, so any input/advice would be greatly appreciated.

Postgresql 9.6 only one database need to replicated. (single database replication)

I am new to PostgreSQL, I am trying to replicate single database like only one database need to replicate from Master to Slave Server.
I think you can find more information here: https://www.postgresql.org/docs/10/static/logical-replication.html
I am not sure without a sample code (from your side) what is your code/error/etc.

sync normalize tables vs json table in postgresql, so i can use graphql and sql, future neo4j

I have not found real sync from postgreSql to new graph database like neo4j, so I've decide to use same postgresql to sync one normalise tables with json table on the same postgresql with a differenta name for a database. So i have the best of two worlds, sql and nosql database.
When i see sql is more fast than graphql i can choose, and in the future, when i moved the nosql tables to a real graph database like neo4j and i ll be able to sync, i dont need to change the app that can use both database synced
Someone did already this? or it's a dumm idea? Or someone already use automatic libraries to sync from postgresql to neo4j ? and the another sens too ? or must I write sync scripts from scratch if i want to sync two databases?