9292 # of DuckDB require a version of DuckDB we no longer support
9393 run : |
9494 source .venv/bin/activate
95+
96+ # Remove semantic_models and metrics sections for DBT versions < 1.6.0
97+ # Using explicit list to avoid version comparison issues
98+ if [[ "${{ matrix.dbt-version }}" == "1.3" ]] || \
99+ [[ "${{ matrix.dbt-version }}" == "1.4" ]] || \
100+ [[ "${{ matrix.dbt-version }}" == "1.5" ]]; then
101+
102+ echo "DBT version is ${{ matrix.dbt-version }} (< 1.6.0), removing semantic_models and metrics sections..."
103+
104+ schema_file="tests/fixtures/dbt/sushi_test/models/schema.yml"
105+ if [[ -f "$schema_file" ]]; then
106+ echo "Modifying $schema_file..."
107+
108+ # Create a temporary file
109+ temp_file=$(mktemp)
110+
111+ # Use awk to remove semantic_models and metrics sections
112+ awk '
113+ /^semantic_models:/ { in_semantic=1; next }
114+ /^metrics:/ { in_metrics=1; next }
115+ /^[^ ]/ && (in_semantic || in_metrics) {
116+ in_semantic=0;
117+ in_metrics=0
118+ }
119+ !in_semantic && !in_metrics { print }
120+ ' "$schema_file" > "$temp_file"
121+
122+ # Move the temp file back
123+ mv "$temp_file" "$schema_file"
124+
125+ echo "Successfully removed semantic_models and metrics sections"
126+ else
127+ echo "Schema file not found at $schema_file, skipping..."
128+ fi
129+ else
130+ echo "DBT version is ${{ matrix.dbt-version }} (>= 1.6.0), keeping semantic_models and metrics sections"
131+ fi
132+
95133 make dbt-fast-test
96134 - name : Test SQLMesh info in sushi_dbt
97135 working-directory : ./examples/sushi_dbt
@@ -104,4 +142,5 @@ jobs:
104142 else
105143 echo "DBT version is ${{ matrix.dbt-version }} (>= 1.5.0), keeping version parameters"
106144 fi
145+
107146 sqlmesh info --skip-connection
0 commit comments