Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get a RAW SQL file using postgresql ? #456

Open
pulse-mind opened this issue Jul 31, 2022 · 1 comment
Open

How to get a RAW SQL file using postgresql ? #456

pulse-mind opened this issue Jul 31, 2022 · 1 comment

Comments

@pulse-mind
Copy link

Hi,

I am doing a postgresql backup on linux and I get a binary file. To restore it we need to use pg_restore.
I'd like to have a RAW SQL file where I can run a regular psql command.
How to do that ?

In the documentation it is written :

Postgres uses by default dbbackup.db.postgresql.PgDumpConnector, but we advise you to use dbbackup.db.postgresql.PgDumpBinaryConnector. The first one uses pg_dump and pqsl for its job, creating RAW SQL files.

The second uses pg_restore with binary dump files.

They can also use psql for launching administration command.

In the documentation it is written :

dbbackup.db.postgresql.PgDumpConnector for django.db.backends.postgresql

My database configuration is
DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql',...

May be the documentation should be updated to say that

dbbackup.db.postgresql.PgDumpBinaryConnector for django.db.backends.postgresql

Which is probably the right thing:
https://github.com/jazzband/django-dbbackup/blob/master/dbbackup/db/base.py

Or ....?

Should I add

DBBACKUP_CONNECTOR_MAPPING = {
    'django.db.backends.postgresql': 'dbbackup.db.postgresql.PgDumpConnector',
}
@gschurck
Copy link

You need to set this configuration in settings.py to override the default config of dbbackup :

DBBACKUP_CONNECTOR_MAPPING = {
    "django.db.backends.postgresql": "dbbackup.db.postgresql.PgDumpConnector",
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants