Problem
You’re attempting to add a materialized view to an existing Delta Live Table (DLT) pipeline written in Python. You add an SQL statement to the notebook to create a new table and notice the SQL statement is ignored.
Cause
DLT notebooks can only contain either Python code or SQL statements, but not both. When a notebook contains both, the SQL statement is ignored.
Solution
Keep your existing DLT pipeline for your Python notebook, and set up a separate pipeline and notebook for SQL statements.
- Create a new DLT pipeline with your SQL notebook.
- Move the SQL statement to the new notebook.
- Run the new pipeline to create the materialized view.
When you’re done, verify that the new table is created in the expected location and your materialized view is updated correctly.