Skip to main content

A comprehensive, config-driven data ingestion library for Python

Project description

Config-Driven Data Loading Framework

Framework that eliminates repetitive data loading code by using configuration files. Instead of writing custom code for each data source, we configure once and reuse everywhere.

Framework Architecture

┌─────────────────┐    ┌──────────────────┐    ┌─────────────────┐
│   DATA SOURCES  │    │   ORCHESTRATOR   │    │  Database       │
│                 │    │                  │    │    Schema       │
│ • CSV Files     │────│ Config Reader    │────│                 │
│ • Excel Files   │    │ Data Processor   │    │ • api_data      │
│ • REST APIs     │    │ Column Mapper    │    │ • market_trends │
│ • JSON Files    │    │ Database Writer  │    │ • risk_metrics  │
└─────────────────┘    └──────────────────┘    └─────────────────┘

Core Components

  • DataSourceFactory: Creates appropriate loaders based on configuration type
  • DataOrchestrator: Manages the entire pipeline with error handling and retry logic [One Time Implementation]
  • DataProcessor: Handles transformations and column mapping
  • DatabaseWriter: Executes batch operations to Database schema tables

Sample Configuration Files

Data Sources Configuration (data-sources.yml)

# Data Sources Configuration for Database Schema
data_sources:
  market_data_csv:
    type: "csv"
    source:
      file_path: "/data/market/daily_rates.csv"
      delimiter: ","
      header: true
      encoding: "UTF-8"
    target:
      schema: "MarketData"
      table: "market_trends"
      batch_size: 500
    column_mapping:
      - source: "date" → target: "trade_date"
      - source: "currency_pair" → target: "currency"
      - source: "rate" → target: "exchange_rate"
      - source: "volume" → target: "trading_volume"
  risk_metrics_excel:
    type: "excel"
    source:
      file_path: "/data/risk/monthly_risk.xlsx"
      sheet_name: "RiskData"
      skip_rows: 1
    target:
      schema: "RiskMetrics"
      table: "risk_metrics"
      batch_size: 200
    column_mapping:
      - source: "Portfolio ID" → target: "portfolio_id"
      - source: "VaR 95%" → target: "var_95"
      - source: "Expected Shortfall" → target: "expected_shortfall"
      - source: "Liquidity Score" → target: "liquidity_score"
    validation:
      required_columns: ["Portfolio ID", "VaR 95%"]
      data_quality_checks: true
  rest_api_data:
    type: "rest_api"
    source:
      url: "https://api.provider.com/v1/liq"
      method: "GET"
      headers:
        Authorization: "Bearer ${API_TOKEN}"
        Content-Type: "application/json"
      timeout: 30
      retry_attempts: 3
    target:
      schema: "APIData"
      table: "forecast_data"
      batch_size: 1000
    column_mapping:
      - source: "id" → target: "id"
      - source: "assetClass" → target: "asset_class"
      - source: "predictedLiquidity" → target: "predicted_liquidity"
      - source: "confidenceLevel" → target: "confidence_level"
      - source: "forecastDate" → target: "forecast_date"
  config_json:
    type: "json"
    source:
      file_path: "/config/portfolio_settings.json"
      json_path: "$.portfolios[*]"
    target:
      schema: "ConfigData"
      table: "portfolio_config"
      batch_size: 100
    column_mapping:
      - source: "id" → target: "portfolio_id"
      - source: "name" → target: "portfolio_name"
      - source: "riskProfile" → target: "risk_profile"
      - source: "liquidityThreshold" → target: "liquidity_threshold"

# Global Settings
global_settings:
  error_handling:
    continue_on_error: true
    error_threshold: 10
    notification_email: "dev-team@company.com"
  data_quality:
    enable_validation: true
    null_value_handling: "skip"
    duplicate_handling: "ignore"
  performance:
    connection_pool_size: 10
    query_timeout: 300
    memory_limit: "2GB"

High Level Architecture Diagram

Architecture

Class Diagram

Class

Sequence Diagram

Sequence

Key Developer Benefits

  • Code Reusability: Write once, configure multiple times - no duplicate data loading logic
  • Maintenance Reduction: Single codebase handles all data sources through configuration
  • Easy Onboarding: New data sources added via YAML files, not code changes
  • Error Handling: Built-in retry logic and comprehensive error reporting
  • Performance: Batch processing and connection pooling optimize database operations

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

config_driven_data_ingestion-1.0.2.tar.gz (25.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

config_driven_data_ingestion-1.0.2-py3-none-any.whl (28.9 kB view details)

Uploaded Python 3

File details

Details for the file config_driven_data_ingestion-1.0.2.tar.gz.

File metadata

File hashes

Hashes for config_driven_data_ingestion-1.0.2.tar.gz
Algorithm Hash digest
SHA256 f08cd627bdba81e28e121fa35fcba2667bb567005f429b1ce20129130f216982
MD5 3eea9bff3185aba279cdfa507a5d692c
BLAKE2b-256 370fecd4c3a4e7f4dc05ecbf589f53ffb7827fabaedbc789ae34884655d10a86

See more details on using hashes here.

File details

Details for the file config_driven_data_ingestion-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for config_driven_data_ingestion-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 47972c4cd82996a78e19d1115de202dba57ed0c6a5989a2ccdcd29df08a53061
MD5 fc0ad9f20bf6c42c07aa3351d1e12ed6
BLAKE2b-256 f40ce01be64e362eea02e22493d9933ecb50e462a489542527e2c070a9802850

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page