← 输入框|github.com|刷新
Skip to content

fix: Validate entity column types in feast dbt import - #7067

Open
NopeCharon wants to merge 1 commit into
feast-dev:masterfrom
NopeCharon:fix/dbt-entity-column-type-warning
Open

NopeCharon wants to merge 1 commit into
feast-dev:masterfrom
NopeCharon:fix/dbt-entity-column-type-warning

Conversation

@NopeCharon

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

feast dbt import only checks that the entity columns exist. Their type is never looked at:

  • A model whose entity column is declared FLOAT64, BOOLEAN, BYTES or TIMESTAMP imports silently, and Feast creates an entity keyed on a floating point, boolean, binary or timestamp value.
  • A model with an ARRAY<...> entity column crashes the whole import with an unhandled ValueError: Entity driver_id has type ValueType.STRING, which does not match the inferred type Array(...) raised from FeatureView.__init__.

With this PR, the import maps each entity column's dbt type through the existing map_dbt_type_to_feast_type mapping and then:

  • Array entity column: the model is skipped with a warning (Model '...' has array entity column(s): ... Skipping.). This matches how models missing an entity or timestamp column are handled.
  • Any type other than String, Int32 or Int64: a warning names the dbt type and the Feast type it maps to, and the model is still imported. For example: Warning: Model 'driver_features' entity column 'conv_rate' has type 'float64' (Feast type Float64), which may not be suitable as an entity key. Recommended types: STRING, INT64. Importing anyway. This also flags Snowflake's NUMBER(38,0), which the mapping turns into Float64.
  • No data_type: columns without one default to STRING and do not warn.

The models used for the summary and for --output code generation are now collected as they are processed, instead of being recomputed afterwards from column presence. Otherwise a skipped model would still be written into the generated file.

The dbt how-to documents the check and the two new warnings in its Requirements and Troubleshooting sections.

Which issue(s) this PR fixes:

Fixes #5876

Checks

  • I've made sure the tests are passing.
  • My commits are signed off (git commit -s)
  • My PR title follows conventional commits format

Testing Strategy

  • Unit tests
  • Integration tests
  • Manual tests
  • Testing is not required for this change

Unit tests: the new sdk/python/tests/unit/dbt/test_entity_column_type.py builds manifests and runs feast dbt import through the CLI. It covers:

  • a warning for FLOAT64, NUMBER(38,0), BOOLEAN, BYTES and TIMESTAMP, with the model still imported
  • no warning for STRING, VARCHAR(36), INT64, INTEGER, NUMBER(10,0) and an undeclared type
  • with several entity columns, only the unsuitable one warns
  • a model with an ARRAY<INT64> entity column is skipped, and with --output it is left out of the generated file while the other model is kept

Seven of these cases fail on master (the array case with the ValueError above). All 50 tests in tests/unit/dbt pass.

Integration tests: make test-python-integration-dbt (dbt-core + dbt-duckdb) passes, 84 tests.

Manual tests: ran feast dbt import --dry-run against the integration project's generated manifest with -e driver_id (no warning) and -e conv_rate (warning shown).

Static checks: scoped ruff check, ruff format --check and mypy are clean.

`feast dbt import` only checked that the entity columns exist. A model
whose entity column is declared as FLOAT64, BOOLEAN, BYTES or TIMESTAMP
was imported silently, producing an entity keyed on a floating point,
boolean, binary or timestamp value. A model with an ARRAY entity column
crashed the whole import with an unhandled ValueError from FeatureView.

The import now maps each entity column's dbt type through the existing
dbt-to-Feast type mapping and:

- skips models with an array entity column, with a warning, in the same
  way as models that miss an entity or timestamp column;
- prints a warning for entity columns that map to anything other than
  String, Int32 or Int64, naming the dbt type and the Feast type it maps
  to, and still imports the model. This also flags Snowflake's
  NUMBER(38,0), which the mapping turns into Float64.

Columns without a declared data_type default to STRING and do not warn.

The list of imported models used for the summary and for --output code
generation is now collected while processing models instead of being
recomputed afterwards from column presence, so skipped models can no
longer leak into the generated file.

The dbt how-to documents the check and the new warnings.

Fixes feast-dev#5876

Signed-off-by: NopeCharon <115794254+NopeCharon@users.noreply.github.com>
@NopeCharon
NopeCharon requested a review from a team as a code owner October 23, 2026 16:46

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dbt integration: Validate entity column data type is appropriate

1 participant