- Connecting pgAdmin and Postgres
1.1 Set up the docker container
docker build -t taxi_ingest:v001 .
docker network create pg-network
docker run -it \
-e POSTGRES_USER="root" \
-e POSTGRES_PASSWORD="root" \
-e POSTGRES_DB="ny_taxi" \
-v $(pwd)/ny_taxi_postgres_data:/var/lib/postgresql/data \
-p 5432:5432 \
--network=pg-network \
--name pg-database \
postgres:13
docker run -it \
-e PGADMIN_DEFAULT_EMAIL="admin@admin.com" \
-e PGADMIN_DEFAULT_PASSWORD="root" \
-p 8080:80 \
--network=pg-network \
--name pgadmin \
dpage/pgadmin4
Load table: yellow_taxi_trips
URL="https://d37ci6vzurychx.cloudfront.net/trip-data/yellow_tripdata_2024-01.parquet"
docker run -it \
--network=pg-network \
taxi_ingest:v001 \
--user=root \
--password=root \
--host=pg-database \
--port=5432 \
--db=ny_taxi \
--table_name=yellow_taxi_trips \
--url=${URL}
Load table: taxi_zone_lookup
URL="https://d37ci6vzurychx.cloudfront.net/misc/taxi_zone_lookup.csv"
docker run -it \
--network=pg-network \
taxi_ingest:v001 \
--user=root \
--password=root \
--host=pg-database \
--port=5432 \
--db=ny_taxi \
--table_name=taxi_zone_lookup \
--url=${URL}
Open your terminal and run the following command:
docker-compose up
Open Chrome and navigate to "localhost:8080". After logging in to pgAdmin, connect to the PostgreSQL server.
To shut down the containers, run:
docker-compose down