Skip to content

dbt integration: Add validation for timestamp field data type #5871

Open

Description

@YassinNouh21

Context

PR #5827 added dbt integration that requires a timestamp field for point-in-time correctness.

Problem

The code validates that the timestamp field exists in the model columns but doesn't validate that it's actually a timestamp type. This could lead to runtime errors or incorrect behavior.

Current Behavior

# In dbt_import.py:183-189
if timestamp_field not in column_names:
    click.echo(
        f"{Fore.YELLOW}Warning: Model '{model.name}' missing timestamp "
        f"field '{timestamp_field}'. Skipping.{Style.RESET_ALL}"
    )
    continue

No type checking is performed.

Proposed Solution

Add validation that the timestamp field is one of the timestamp types:

  • TIMESTAMP
  • TIMESTAMP_NTZ / TIMESTAMP_LTZ / TIMESTAMP_TZ
  • DATETIME
  • DATE

Warn users if the field exists but has an incompatible type.

Example

timestamp_col = next((c for c in model.columns if c.name == timestamp_field), None)
if timestamp_col:
    normalized_type = timestamp_col.data_type.upper()
    valid_ts_types = ['TIMESTAMP', 'TIMESTAMP_NTZ', 'TIMESTAMP_LTZ', 'TIMESTAMP_TZ', 'DATETIME', 'DATE']
    if not any(t in normalized_type for t in valid_ts_types):
        click.echo(f"{Fore.YELLOW}Warning: Timestamp field '{timestamp_field}' has type '{timestamp_col.data_type}' which may not be suitable{Style.RESET_ALL}")

Related

Activity

  1. darshil929 commented on Oct 17, 2026

    @darshil929

    I’d like to work on this. I’ll check the existing timestamp type mapping and put together a focused validation change with tests.

    Could a maintainer assign this to me?

  2. luc-pimentel commented on Oct 19, 2026

    @luc-pimentel

    Reproduced on Feast 0.67.0 and current master. A dbt model whose event_timestamp column is declared STRING or INT64 imports with no warning; only a missing column is caught. A FeatureView built that way fails at get_historical_features with AttributeError: 'str' object has no attribute 'tzinfo'.

    In sdk/python/feast/cli/dbt_import.py, import_command checks only that the timestamp column exists. Fix in #7038: the column's dbt type is checked through the existing type mapping and a warning is printed when it is not a timestamp type; the model is still imported. Columns with no declared data_type reach the CLI as STRING and trigger the same warning.

    AI-assisted implementation and tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions