diff --git a/src/dbt_core_interface/project.py b/src/dbt_core_interface/project.py index 634cce8..22a808f 100644 --- a/src/dbt_core_interface/project.py +++ b/src/dbt_core_interface/project.py @@ -703,8 +703,9 @@ def generate_server_node( This is a context manager that will clear the node after execution and leverages a mutex during manifest mutation. """ - # Remove {% ... %} patterns from the SQL string - sql = re.sub(r'{%.*?%}', '', sql, flags=re.DOTALL) + # Remove only the opening and closing snapshot tags, keep the body + sql = re.sub(r'{%\s*snapshot\b.*?%}', '', sql, flags=re.DOTALL) + sql = re.sub(r'{%\s*endsnapshot\s*%}', '', sql, flags=re.DOTALL) with self.manifest_mutation_mutex: self._clear_node(node_name) sql_node = self.sql_parser.parse_remote(sql, node_name)