1

I got json database dump file to import into postgres but this file is not sql file (which I know how to import) it is json file. Its structure looks like this:

[
    {
      "model": "model.name",
      "pk": 1,
      "fields": {
        "version": 1584369114566125,
        "field_a": "something",
        "field_b": "something"
      }
    },
    {
        "model": "model.name",
        "pk": 1,
        "fields": {
            "version": 1584369114566125,
            "field_a": "something",
            "field_b": "something"
        }
    },
    ...
]

I want to import it but I don't know if is there option for importing database in such format and structure without writing sql function? I was trying to find if there is in documentation of pg_dump any option for exporting in json but I didn't find. My guess is also that server is written in django and maybe django has script for exporting/importing database in such file?

0

1 Answer 1

2

The format you posted looks like a fixture:

You’ll store this data in a fixtures directory inside your app. [...] You can load data by calling manage.py loaddata <fixturename>, where <fixturename> is the name of the fixture file you’ve created. Each

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

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.