Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/dbt_core_interface/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down