@@ -104,4 +104,42 @@ jobs:
104104 else
105105 echo "DBT version is ${{ matrix.dbt-version }} (>= 1.5.0), keeping version parameters"
106106 fi
107+
108+ # Remove semantic_models and metrics sections for DBT versions < 1.6.0
109+ # Using explicit list to avoid version comparison issues
110+ if [[ "${{ matrix.dbt-version }}" == "1.3.0" ]] || \
111+ [[ "${{ matrix.dbt-version }}" == "1.4.0" ]] || \
112+ [[ "${{ matrix.dbt-version }}" == "1.5.0" ]]; then
113+
114+ echo "DBT version is ${{ matrix.dbt-version }} (< 1.6.0), removing semantic_models and metrics sections..."
115+
116+ schema_file="../../tests/fixtures/dbt/sushi_test/models/schema.yml"
117+ if [[ -f "$schema_file" ]]; then
118+ echo "Modifying $schema_file..."
119+
120+ # Create a temporary file
121+ temp_file=$(mktemp)
122+
123+ # Use awk to remove semantic_models and metrics sections
124+ awk '
125+ /^semantic_models:/ { in_semantic=1; next }
126+ /^metrics:/ { in_metrics=1; next }
127+ /^[^ ]/ && (in_semantic || in_metrics) {
128+ in_semantic=0;
129+ in_metrics=0
130+ }
131+ !in_semantic && !in_metrics { print }
132+ ' "$schema_file" > "$temp_file"
133+
134+ # Move the temp file back
135+ mv "$temp_file" "$schema_file"
136+
137+ echo "Successfully removed semantic_models and metrics sections"
138+ else
139+ echo "Schema file not found at $schema_file, skipping..."
140+ fi
141+ else
142+ echo "DBT version is ${{ matrix.dbt-version }} (>= 1.6.0), keeping semantic_models and metrics sections"
143+ fi
144+
107145 sqlmesh info --skip-connection
0 commit comments