L
L
LakeForest2020-11-19 15:34:10
PostgreSQL
LakeForest, 2020-11-19 15:34:10

How to write and run schema fill function on postgres from dump sql(schemas don't match) in django?

I'm new to django and never had to work with dumps...
Faced the problem that I have a database dump with the data I need, but the schema will be completely different from my new schema in Django

Can't tell me how to populate my schema tables from the dump ? I understand that I need to write my own sql script to fill in my schema and run it one-time, but I can’t figure out where to write it, how to run it from django?... Or what should I do?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Kuts, 2020-11-19
@LakeForest

1. Create a new database. Pour a dump into it.
2. Read the section about the interaction of Django with external databases
3. Connect the created database as an external one and use Django to pull data into the project database (read objects from the external database - create objects in our own by converting the necessary fields)
4. Profit

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question