<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to create a DLT pipeline with SQL statement in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-to-create-a-dlt-pipeline-with-sql-statement/m-p/88890#M37655</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/109070"&gt;@guangyi&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;As&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/110502"&gt;@szymon_dybczak&lt;/a&gt;&amp;nbsp;informed, .py and .sql formats are supported. The 2 first options you mentioned are not supported: you cannot use SQL in .py files, but SQL commands supported when .sql file is used.&lt;BR /&gt;&lt;BR /&gt;Check the docs:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="filipniziol_0-1725635057151.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/10987i592B26126DF1AB23/image-size/medium?v=v2&amp;amp;px=400" role="button" title="filipniziol_0-1725635057151.png" alt="filipniziol_0-1725635057151.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/azure/databricks/delta-live-tables/tutorial-pipelines#sql-example" target="_blank"&gt;https://learn.microsoft.com/en-us/azure/databricks/delta-live-tables/tutorial-pipelines#sql-example&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 06 Sep 2024 15:05:02 GMT</pubDate>
    <dc:creator>filipniziol</dc:creator>
    <dc:date>2024-09-06T15:05:02Z</dc:date>
    <item>
      <title>How to create a DLT pipeline with SQL statement</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-create-a-dlt-pipeline-with-sql-statement/m-p/88842#M37636</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I need a DLT pipeline to create a materialized view for fetching event logs. All the ways below I tried are failed:&lt;/SPAN&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;SPAN&gt;Attach a notebook with pure SQL inside: No magic cell like `%sql` are failed&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Attach a notebook with `spark.sql` python code: Failed because I cannot use the `CREATE VIEW` statement.&lt;/SPAN&gt;&lt;/LI&gt;&lt;LI&gt;&lt;SPAN&gt;Attach a file with `.sql` format: Failed because sql format is not supported yet.&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;SPAN&gt;I follow the instructions here to query event log: &lt;/SPAN&gt;&lt;A href="https://docs.databricks.com/en/delta-live-tables/observability.html#monitor-delta-live-tables-pipelines" target="_blank" rel="noopener"&gt;&lt;SPAN&gt;https://docs.databricks.com/en/delta-live-tables/observability.html#monitor-delta-live-tables-pipelines&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;How can I achieve this with the DLT pipeline?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2024 09:23:06 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-create-a-dlt-pipeline-with-sql-statement/m-p/88842#M37636</guid>
      <dc:creator>guangyi</dc:creator>
      <dc:date>2024-09-06T09:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a DLT pipeline with SQL statement</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-create-a-dlt-pipeline-with-sql-statement/m-p/88845#M37638</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/109070"&gt;@guangyi&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;It should be sufficient to attach notebook with sql language set as a default. What error did you get?&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2024 09:39:05 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-create-a-dlt-pipeline-with-sql-statement/m-p/88845#M37638</guid>
      <dc:creator>szymon_dybczak</dc:creator>
      <dc:date>2024-09-06T09:39:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a DLT pipeline with SQL statement</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-create-a-dlt-pipeline-with-sql-statement/m-p/88890#M37655</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/109070"&gt;@guangyi&lt;/a&gt;&amp;nbsp;,&lt;BR /&gt;As&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/110502"&gt;@szymon_dybczak&lt;/a&gt;&amp;nbsp;informed, .py and .sql formats are supported. The 2 first options you mentioned are not supported: you cannot use SQL in .py files, but SQL commands supported when .sql file is used.&lt;BR /&gt;&lt;BR /&gt;Check the docs:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="filipniziol_0-1725635057151.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/10987i592B26126DF1AB23/image-size/medium?v=v2&amp;amp;px=400" role="button" title="filipniziol_0-1725635057151.png" alt="filipniziol_0-1725635057151.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/azure/databricks/delta-live-tables/tutorial-pipelines#sql-example" target="_blank"&gt;https://learn.microsoft.com/en-us/azure/databricks/delta-live-tables/tutorial-pipelines#sql-example&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Sep 2024 15:05:02 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-create-a-dlt-pipeline-with-sql-statement/m-p/88890#M37655</guid>
      <dc:creator>filipniziol</dc:creator>
      <dc:date>2024-09-06T15:05:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a DLT pipeline with SQL statement</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-create-a-dlt-pipeline-with-sql-statement/m-p/89103#M37691</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/110502"&gt;@szymon_dybczak&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/117376"&gt;@filipniziol&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Here is how I implement the 3rd option and how it failed:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I create a JSON file with the DLT pipeline definition inside&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
    "name": "query_data_quality_event_log_pipeline",
    "clusters": [
        {
            "label": "default",
            "spark_conf": {
                "spark.databricks.acl.needAdminPermissionToViewLogs": "false"
            },
            "policy_id": "xxxxxx",
            "autoscale": {
                "min_workers": 1,
                "max_workers": 2,
                "mode": "ENHANCED"
            }
        },
        {
            "label": "maintenance",
            "policy_id": "xxxxxx"
        }
    ],
    "development": true,
    "continuous": false,
    "channel": "PREVIEW",
    "edition": "CORE",
    "catalog": "xxxxxx",
    "target": "xxxxxx",
    "libraries": [
        {
            "notebook": {
                "path": "/Workspace/Users/xxx@xxx/query_data_quality_event_log.sql"
            }
        }
    ]
}&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;Then create the pipeline via Databricks CLI&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;databricks pipelines create --json "$(cat single-dlt.json)" -p PID&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;The pipeline can be created successfully. However, when I clicked the running button, It show me this result:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;BAD_REQUEST: Failed to load&amp;nbsp; notebook '/Workspace/Users/xxx@xxx/query_data_quality_event_log.sql'. Only SQL and Python notebooks are supported currently.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2024 01:34:33 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-create-a-dlt-pipeline-with-sql-statement/m-p/89103#M37691</guid>
      <dc:creator>guangyi</dc:creator>
      <dc:date>2024-09-09T01:34:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a DLT pipeline with SQL statement</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-create-a-dlt-pipeline-with-sql-statement/m-p/89105#M37693</link>
      <description>&lt;P&gt;&lt;SPAN&gt;After just finishing my last reply, I realized what’s wrong with my code: I should use “file” property instead of “notebook” in the libraries section.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;It works now. Thank you guys, you are my &lt;A href="https://en.wikipedia.org/wiki/Rubber_duck_debugging" target="_self"&gt;rubber duck!&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Sep 2024 02:00:24 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-create-a-dlt-pipeline-with-sql-statement/m-p/89105#M37693</guid>
      <dc:creator>guangyi</dc:creator>
      <dc:date>2024-09-09T02:00:24Z</dc:date>
    </item>
  </channel>
</rss>

