tattle-made / DAU

MCA Tipline for Deepfakes
GNU General Public License v3.0
6 stars 0 forks source link

Add the hash operator value to a PostgreSQL Database in the worker #91

Closed aatmanvaidya closed 5 months ago

aatmanvaidya commented 6 months ago

Backup and Restore PostgreSQL database - https://www.postgresql.org/docs/current/backup-dump.html

aatmanvaidya commented 6 months ago

Command to access postgres using psql

psql -h postgres -p 5432 -U tattle -d postgres
aatmanvaidya commented 6 months ago

take the backup of the data using pg_dump

RUN apt-get update && apt-get -y upgrade && \
    sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' && \
    wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && \
    apt-get update && apt-get install -y postgresql-client-16

Take the backup of the data

pg_dump -U tattle -h postgres -p 5432 postgres > data.sql

restore the data back up

psql -U tattle -h postgres -p 5432 -d postgres < data.sql

This is the format username - host - port - dbname

aatmanvaidya commented 6 months ago

add UUID value in postgre using SQL - https://stackoverflow.com/questions/52067058/how-to-autogenerate-uuid-for-postgres-in-python

aatmanvaidya commented 6 months ago

Fix commit and rollback issues - https://stackoverflow.com/questions/2979369/databaseerror-current-transaction-is-aborted-commands-ignored-until-end-of-tra See for good explaination - https://stackoverflow.com/questions/10399727/psqlexception-current-transaction-is-aborted-commands-ignored-until-end-of-tra

aatmanvaidya commented 6 months ago

https://boto3.amazonaws.com/v1/documentation/api/1.9.42/guide/s3-example-download-file.html