Local DB: Load Taxi Data to Postgres

Local DB: Load Taxi Data to Postgres

Before we start loading data to GCP, we'll first play with the Yellow and Green Taxi data using a local Postgres database running in a Docker container. We will use the same database from Module 1 which should be in the same Docker Compose file as Kestra.

The flow will extract CSV data partitioned by year and month, create tables, load data to the monthly table, and finally merge the data to the final destination table.

graph LR Start[Select Year & Month] --> SetLabel[Set Labels] SetLabel --> Extract[Extract CSV Data] Extract -->|Taxi=Yellow| YellowFinalTable[Create Yellow Final Table]:::yellow Extract -->|Taxi=Green| GreenFinalTable[Create Green Final Table]:::green YellowFinalTable --> YellowMonthlyTable[Create Yellow Monthly Table]:::yellow GreenFinalTable --> GreenMonthlyTable[Create Green Monthly Table]:::green YellowMonthlyTable --> YellowCopyIn[Load Data to Monthly Table]:::yellow GreenMonthlyTable --> GreenCopyIn[Load Data to Monthly Table]:::green YellowCopyIn --> YellowMerge[Merge Yellow Data]:::yellow GreenCopyIn --> GreenMerge[Merge Green Data]:::green classDef yellow fill:#FFD700,stroke:#000,stroke-width:1px,color:#000; classDef green fill:#32CD32,stroke:#000,stroke-width:1px,color:#000;

The flow code: 04_postgres_taxi.yaml.

[!NOTE] The NYC Taxi and Limousine Commission (TLC) Trip Record Data provided on the nyc.gov website is currently available only in a Parquet format, but this is NOT the dataset we're going to use in this course. For the purpose of this course, we'll use the CSV files available here on GitHub. This is because the Parquet format can be challenging to understand by newcomers, and we want to make the course as accessible as possible — the CSV format can be easily introspected using tools like Excel or Google Sheets, or even a simple text editor.

Resources

Optional analytics

Optional analytics are off unless you allow them. Your choice does not affect access to DataTalks.Club, Slack, events, or courses.

Current choice: not chosen.

Privacy Policy

If you allow analytics, self-hosted Umami counts anonymous public pageviews without analytics cookies. Private account and learning pages are excluded. Read the Privacy Policy for the complete data boundary.