version: 2

models:
  - name: raw_s3_bots_generatedclip_insert
    description: |
      External table reading raw bots_generatedclip data from S3 parquet files.
      This model reads directly from the S3 stage where Glue exports data from RDS bots_generatedclip table.
      The data is partitioned by pdate and phour in the S3 path structure.
      This replaces the need to read directly from the stage in the DIM_CLIP_INSERT_PROC procedure.
    config:
      group: rds
      tags:
        [
          "partition_type=hourly",
          "automation_condition=hourly_cron_with_eager_historical_backfill_condition",
        ]
    meta:
      dagster:
        partition_start_date: "2023-05-12"  # Matches DIM_CLIP_START_DATE
        partition_start_hour: 0
        end_offset: 0
        backfill_policy:
          max_partitions_per_run: 336  # 2 weeks
    columns:
      - name: id
        description: "Clip ID from the parquet file"
      - name: created_at
        description: "Timestamp when the clip was created"
      - name: user_id
        description: "User ID who created the clip"
      - name: request_id
        description: "Request ID for the generation"
      - name: s3_id
        description: "S3 object identifier for the clip's audio file"
      - name: status
        description: "Status of the clip (e.g., complete, failed)"
      - name: batch_index
        description: "Index within batch generation request"
      - name: title
        description: "Title of the clip"
      - name: time_used
        description: "Time in seconds taken to generate"
      - name: prompt_text
        description: "Prompt text used for generation"
      - name: model_name
        description: "Model name used for generation"
      - name: metadata
        description: "JSON metadata containing additional generation parameters (parsed as VARIANT)"
      - name: p_date
        description: "Partition date parsed from file path (METADATA$FILENAME)"
      - name: p_hour
        description: "Partition hour parsed from file path (METADATA$FILENAME)"

