contratospr-api
contratospr-api copied to clipboard
Get a current database dump
I've been asked for a dump of our database with our most current data. The purpose is to use this dump for some data analysis.
@jpadilla any thoughts on how best to fulfill this request?
I recommend doing something like this:
pg_dump -v -Fc --no-acl --no-owner \
-h <HOST> \
-U <USERNAME> \
--table=contracts_contract \
--table=contracts_contract_contractors \
--table=contracts_contractor \
--table=contracts_document \
--table=contracts_entity \
--table=contracts_service \
--table=contracts_servicegroup \
<DATABASE> > contratospr-api-2020-08-13.dump
Note: This will exclude any session, user, and django-specific tables.
Get details from DATABASE_URL in heroku config -a contratospr-api
. You'll need to make sure it can be imported back, with a local postgres database running:
pg_restore --verbose --clean --no-acl --no-owner \
-h localhost \
-U myuser \
-d mydb \
contratospr-api-2020-08-13.dump
Ideally afterwards that's confirmed, use the AWS credentials(from heroku config
as well) to upload to S3:
aws s3 cp ./contratospr-api-2020-08-13.dump s3://data.contratospr.com/2020-08-13/ --acl public-read
Ideally afterwards that's confirmed, use the AWS credentials(from heroku config as well) to upload to S3:
This was what I was really wondering about
I'll work on it later today. Thanks!
This Issue is being marked as Stale because it has 30 days without any interaction. CC: @froi @jpadilla