<?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 DLT table not picked in python notebook in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/dlt-table-not-picked-in-python-notebook/m-p/68716#M33727</link>
    <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am a bit stumped atm bc I cannot figure out how to get a DLT table definition picked up in a Python notebook.&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. I created a new notebook in python&lt;/P&gt;&lt;P&gt;2. added the following code:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;%python
import dlt
from pyspark.sql.functions import *

@dlt.table(
    comment="Some simple test",
    name="trx_dlt"
)
def transactions_live_table():
    df = spark.read.json("s3://FOLDER_LOCATION/Transaction/")
    return df&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. I created a new DLT pipeline and linked the Notebook. Linking did work bc the Notebook UI now allows me to validate my pieline code.&lt;/P&gt;&lt;P&gt;4. I press play and get&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;a. a warning the python magic command is not supported:&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;Magic commands (e.g. %py, %sql and %run) are not supported with the exception of %pip within a Python notebook. Cells containing magic commands are ignored. Unsupported magic commands were found in the following notebooks&lt;/P&gt;&lt;P class=""&gt;/Users/mathias.peters@epicompany.eu/DLT-TRX: %python&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp; b. an error that no DLT tables were discovered in the code:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Mathias_Peters_0-1715334658498.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/7517iF0482D2D3538C215/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="Mathias_Peters_0-1715334658498.png" alt="Mathias_Peters_0-1715334658498.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How does that work? Where is my mistake here?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mathias&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 10 May 2024 09:51:48 GMT</pubDate>
    <dc:creator>Mathias_Peters</dc:creator>
    <dc:date>2024-05-10T09:51:48Z</dc:date>
    <item>
      <title>DLT table not picked in python notebook</title>
      <link>https://community.databricks.com/t5/data-engineering/dlt-table-not-picked-in-python-notebook/m-p/68716#M33727</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am a bit stumped atm bc I cannot figure out how to get a DLT table definition picked up in a Python notebook.&amp;nbsp;&lt;/P&gt;&lt;P&gt;1. I created a new notebook in python&lt;/P&gt;&lt;P&gt;2. added the following code:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;%python
import dlt
from pyspark.sql.functions import *

@dlt.table(
    comment="Some simple test",
    name="trx_dlt"
)
def transactions_live_table():
    df = spark.read.json("s3://FOLDER_LOCATION/Transaction/")
    return df&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. I created a new DLT pipeline and linked the Notebook. Linking did work bc the Notebook UI now allows me to validate my pieline code.&lt;/P&gt;&lt;P&gt;4. I press play and get&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;a. a warning the python magic command is not supported:&amp;nbsp;&lt;/P&gt;&lt;P class=""&gt;Magic commands (e.g. %py, %sql and %run) are not supported with the exception of %pip within a Python notebook. Cells containing magic commands are ignored. Unsupported magic commands were found in the following notebooks&lt;/P&gt;&lt;P class=""&gt;/Users/mathias.peters@epicompany.eu/DLT-TRX: %python&lt;/P&gt;&lt;P class=""&gt;&amp;nbsp; b. an error that no DLT tables were discovered in the code:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Mathias_Peters_0-1715334658498.png" style="width: 400px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/7517iF0482D2D3538C215/image-size/medium/is-moderation-mode/true?v=v2&amp;amp;px=400" role="button" title="Mathias_Peters_0-1715334658498.png" alt="Mathias_Peters_0-1715334658498.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How does that work? Where is my mistake here?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Kind regards,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Mathias&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2024 09:51:48 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/dlt-table-not-picked-in-python-notebook/m-p/68716#M33727</guid>
      <dc:creator>Mathias_Peters</dc:creator>
      <dc:date>2024-05-10T09:51:48Z</dc:date>
    </item>
    <item>
      <title>Re: DLT table not picked in python notebook</title>
      <link>https://community.databricks.com/t5/data-engineering/dlt-table-not-picked-in-python-notebook/m-p/68735#M33731</link>
      <description>&lt;P&gt;Update: this seems to be an issue with the notebook type and the magic commands at the beginnning. I have created a new DLT pipeline without attaching a notebook to it. That triggered the creation of an empty Python notebook. Switching this to SQL added the %sql command. Running the pipeline produced the same no tables discovered error as above. What is the correct way of specifying the notebook type here? (super unintuitive btw)&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2024 13:02:11 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/dlt-table-not-picked-in-python-notebook/m-p/68735#M33731</guid>
      <dc:creator>Mathias_Peters</dc:creator>
      <dc:date>2024-05-10T13:02:11Z</dc:date>
    </item>
    <item>
      <title>Re: DLT table not picked in python notebook</title>
      <link>https://community.databricks.com/t5/data-engineering/dlt-table-not-picked-in-python-notebook/m-p/68739#M33733</link>
      <description>&lt;P&gt;Ok, it seems that the default language of the notebook and the language of a particular cell can clash. If the default is set to Python, switching a cell to SQL won't work in DLT and vice versa. This is super unintuitive tbh.&lt;/P&gt;</description>
      <pubDate>Fri, 10 May 2024 13:38:55 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/dlt-table-not-picked-in-python-notebook/m-p/68739#M33733</guid>
      <dc:creator>Mathias_Peters</dc:creator>
      <dc:date>2024-05-10T13:38:55Z</dc:date>
    </item>
  </channel>
</rss>

