Skip to content
项目

rat-nick/film-data-ingestion-pipeline

在 GitHub 查看

关于

A repository defining a simple data pipleine for ETL jobs relating to media metadata.

数据与分析

这些数字如何统计

53 星标10 复刻 +1 24小时

实测星标增长

24小时
+1
7天
+1
15天
+1
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

Film Data Ingestion Pipeline

This project is designed to fetch, process, and store film metadata from The Movie Database (TMDB) using Apache Airflow. The pipeline consists of several components including data fetching, processing, and loading into a PostgreSQL database.

Project Structure

  • dags/: Contains the Airflow DAGs.
    • weekly_film_discovery_dag.py: Defines the DAG for discovering and processing films on a weekly basis.
  • dags/utils/: Contains utility scripts.
    • films.py: Contains functions to fetch film data and genres from TMDB.
  • docker-compose.yaml: Docker Compose configuration to set up the Airflow and PostgreSQL services.
  • schema.sql: SQL schema for the database containing the production data.

Getting Started

Prerequisites

  • Docker
  • Docker Compose
  • TMDB API key

Setup

  1. Clone the repository:

    git clone https://github.com/yourusername/film-data-ingestion-pipeline.git
    cd film-data-ingestion-pipeline
    
  2. Create a .env and run the following commands:

    touch .env
    echo "TMDB_API_KEY=<your_api_key_here>" >> .env
    echo "AIRFLOW_UID=50000" >> .env
    echo "AIRFLOW_GID=0" >> .env
    
  3. Start the services using Docker Compose:

    docker-compose up -d
    
  4. Access the Airflow webserver at http://localhost:8080 and log in with the default credentials (airflow/airflow).

  5. Add a new connection from the Admin tab. You should use the following parameters:

    Parameter Value
    Connection Id media-metadata-db
    Connection Type Postgres
    Host media-db
    Schema media
    Login media
    Password media
    Port 5432

Of course, you could use a DBaaS like neon, but the free tier is limited for the data that will be ingested. Just don't forget to change the connection parameters.

  1. Enable the weekly_film_discovery DAG and voila!

Usage

The pipeline is scheduled to run weekly and will:

  1. Fetch film data from TMDB.
  2. Process and save the data to a temporary file.
  3. Load the data into the PostgreSQL database.
  4. Clean up temporary files.

Extra

If you wish to explore the media database, the port on the host is 15432

Disclaimer

  • This project uses the TMDB API but is not endorsed or certified by TMDB.
  • TMDB data is used in compliance with their Terms of Use.
  • This project is for personal and educational purposes only and does not redistribute or resell TMDB data.

For more information, visit TMDB's official website.

License

This project is licensed under the BSD 3-Clause License. See the LICENSE file for details.

探索相关项目

加载中…