-1

I need to access the remote database server(linux) and also take its dump to my local(mac).

DATABASES = {
'default': {
    'ENGINE': 'django.db.backends.postgresql_psycopg2',
    'NAME': 'test-name',
    'USER': 'test-user',
    'PASSWORD': 'pwd',
    'HOST': 'test.amazonaws.com',
    }
}
1

1 Answer 1

0

In local bash, you can connect and dump the remote database with pg_dump command, see Copying PostgreSQL database to another server

Using Python is similar, except that you need to use psycopg2 module to connect and send commands to database server. You may find this post useful Postgresql Database Backup Using Python

Alternatively, if you need to execute the script in the database server, a better idea would be dump it remotely, then fetch it to local machine.

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.