Description
In macros/plugins/fabric/create_external_table.sql, the nullity check on line 12 references columns.tests (the entire collection) instead of column.tests (the current loop variable). This causes all columns to receive identical nullity settings regardless of their individual test configurations.
Current behavior
{% for column in columns %}
{%- set nullity = 'NOT NULL' if 'not_null' in columns.tests else 'NULL'-%}
The columns variable is the full source_node.columns.values() collection. Checking columns.tests evaluates the same value on every loop iteration, so every column gets the same NOT NULL or NULL designation.
Expected behavior
{% for column in columns %}
{%- set nullity = 'NOT NULL' if 'not_null' in column.tests else 'NULL'-%}
The check should reference column.tests (the individual loop variable) so each column's nullity is determined by its own test configuration.
Steps to reproduce
- Define a Fabric external source with multiple columns
- Add a
not_null test to only one column
- Run
dbt run-operation stage_external_sources
- Observe that all columns get
NOT NULL (or all get NULL), rather than only the tested column
Environment
- dbt-external-tables (main branch)
- Adapter: Fabric
Description
In
macros/plugins/fabric/create_external_table.sql, the nullity check on line 12 referencescolumns.tests(the entire collection) instead ofcolumn.tests(the current loop variable). This causes all columns to receive identical nullity settings regardless of their individual test configurations.Current behavior
The
columnsvariable is the fullsource_node.columns.values()collection. Checkingcolumns.testsevaluates the same value on every loop iteration, so every column gets the sameNOT NULLorNULLdesignation.Expected behavior
The check should reference
column.tests(the individual loop variable) so each column's nullity is determined by its own test configuration.Steps to reproduce
not_nulltest to only one columndbt run-operation stage_external_sourcesNOT NULL(or all getNULL), rather than only the tested columnEnvironment