employees-database icon indicating copy to clipboard operation
employees-database copied to clipboard

Loading to postgres

Open mtusman-ai opened this issue 4 years ago • 1 comments

Hello,

I am not able to load test file into Postgres. Can you please help how to include this database into psql?

Many thanks

mtusman-ai avatar Apr 30 '21 19:04 mtusman-ai

The following works via the command line on Windows for Postgres 12, and should work on Linux very similarly:

# Grab employees_data.sql.bz2 and decompress it with `bzip2 -d employees_data.sql.bz2` or your favorite compatible archive tool

# Set (or export) environment variables for greater ease (else add them on the command line as appropriate):
set PGHOST=localhost
set PGUSER=postgres
set PGPASSWORD=<postgres password>

# Remove the old DB if present
dropdb --if-exists employees_sample

# Create the new DB
createdb -O postgres -E UTF-8 employees_sample

# Import the data to the new DB
psql employees_sample < employees_data.sql

MartinFalatic avatar Jul 17 '21 05:07 MartinFalatic