Postgres

Reset Auto-Increment IDs …

If you’ve ever needed to “reset” the auto-incrementing row ID in a Postgres database here is a simple command to start fresh (this should work for any SQL based DB really). Typically during the development life cycle I want to generate new dummy data for testing purposes. Sometimes …

Copy Data from Postgres …

If you need to export data as a .csv file from Postgres and use Docker, here is a simple command to do just that. Using the Docker exec command we can COPY data from a PostgreSQL container to a .csv file on the host machine. docker exec -u <POSTGRES USER> <CONTAINER NAME> -d <POSTGRES …

Export PostgreSQL …

This simple command can be run from a terminal to export data (and schema) to a local file from the Docker database container. This assumes that data only lives within the container and is not persisted using a Docker Volume. You might have a configuration like this for local development or testing. …