Simple ETL
This guide shows you how to work with GCP Cloud SQL and Firebase Cloud Functions locally using Docker Compose and Python. This lab demonstrates how to process a CSV upload via a Cloud Storage trigger and insert records into PostgreSQL.
Prerequisites
Section titled “Prerequisites”- Docker installed and running.
- Dev Containers extension installed (optional).
How to execute
Section titled “How to execute”-
Setup Environment:
Open VS Code in the project folder and execute this command in the Command Palette:
Terminal window > Dev Containers: Reopen in Container- Start Infrastructure: Launch the PostgreSQL container:
Terminal window docker compose up -d postgres - Run the setup script to install tools and dependencies:
Terminal window scripts/setup-mve.sh
- Start Infrastructure: Launch the PostgreSQL container:
-
Start Firebase Emulators:
Terminal window firebase emulators:start -
Run the Example:
Terminal window python main.py
Validate results
Section titled “Validate results”Open the Firebase Emulator UI and verify the uploaded file and function logs:
http://localhost:4000/storagehttp://localhost:4000/functionsOpen the SQLTools extension in VS Code and use the preconfigured Postgres connection to run:
SELECT * FROM users;Connect using an external client like DBeaver, configure the connection details defined in your .env and run:
SELECT * FROM users;Clean Up
Section titled “Clean Up”docker compose down -v