<?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 using the result of one view in another table with collect() in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/dlt-using-the-result-of-one-view-in-another-table-with-collect/m-p/15968#M10212</link>
    <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;Do you guys know, if there is an option to implement something like this in DLT:&lt;/P&gt;&lt;P&gt;@dlt.view()&lt;/P&gt;&lt;P&gt;def view_1():&lt;/P&gt;&lt;P&gt;   # some calculations that return a small dataframe with around max 80 rows&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@dlt.table()&lt;/P&gt;&lt;P&gt;&lt;I&gt;def &lt;/I&gt;table_1():&lt;/P&gt;&lt;P&gt;   result_df = dlt.read("view_1")&lt;/P&gt;&lt;P&gt;   results = [row[0] &lt;I&gt;for &lt;/I&gt;row &lt;I&gt;in &lt;/I&gt;result_df.collect()]&lt;/P&gt;&lt;P&gt;   for result in results:&lt;/P&gt;&lt;P&gt;      # do some more calculations where results are used &lt;/P&gt;&lt;P&gt;I saw this point in the documentation &lt;A href="https://docs.databricks.com/workflows/delta-live-tables/delta-live-tables-python-ref.html#limitations" target="test_blank"&gt;https://docs.databricks.com/workflows/delta-live-tables/delta-live-tables-python-ref.html#limitations&lt;/A&gt;, and I guess it is why this is not working as supposed to (check it with logger and results during calculations is an empty list) I'm not sure what does it mean that it is possible to use collect() outside table or view function, what it gives? I can't do &lt;/P&gt;&lt;P&gt;   result_df = dlt.read("view_1")&lt;/P&gt;&lt;P&gt;   results = [row[0] &lt;I&gt;for &lt;/I&gt;row &lt;I&gt;in &lt;/I&gt;result_df.collect()]&lt;/P&gt;&lt;P&gt;outside the table/view function. Is there and solution to resolve something like that in DLT? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 19 Dec 2022 13:36:37 GMT</pubDate>
    <dc:creator>140015</dc:creator>
    <dc:date>2022-12-19T13:36:37Z</dc:date>
    <item>
      <title>DLT using the result of one view in another table with collect()</title>
      <link>https://community.databricks.com/t5/data-engineering/dlt-using-the-result-of-one-view-in-another-table-with-collect/m-p/15968#M10212</link>
      <description>&lt;P&gt;Hey,&lt;/P&gt;&lt;P&gt;Do you guys know, if there is an option to implement something like this in DLT:&lt;/P&gt;&lt;P&gt;@dlt.view()&lt;/P&gt;&lt;P&gt;def view_1():&lt;/P&gt;&lt;P&gt;   # some calculations that return a small dataframe with around max 80 rows&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;@dlt.table()&lt;/P&gt;&lt;P&gt;&lt;I&gt;def &lt;/I&gt;table_1():&lt;/P&gt;&lt;P&gt;   result_df = dlt.read("view_1")&lt;/P&gt;&lt;P&gt;   results = [row[0] &lt;I&gt;for &lt;/I&gt;row &lt;I&gt;in &lt;/I&gt;result_df.collect()]&lt;/P&gt;&lt;P&gt;   for result in results:&lt;/P&gt;&lt;P&gt;      # do some more calculations where results are used &lt;/P&gt;&lt;P&gt;I saw this point in the documentation &lt;A href="https://docs.databricks.com/workflows/delta-live-tables/delta-live-tables-python-ref.html#limitations" target="test_blank"&gt;https://docs.databricks.com/workflows/delta-live-tables/delta-live-tables-python-ref.html#limitations&lt;/A&gt;, and I guess it is why this is not working as supposed to (check it with logger and results during calculations is an empty list) I'm not sure what does it mean that it is possible to use collect() outside table or view function, what it gives? I can't do &lt;/P&gt;&lt;P&gt;   result_df = dlt.read("view_1")&lt;/P&gt;&lt;P&gt;   results = [row[0] &lt;I&gt;for &lt;/I&gt;row &lt;I&gt;in &lt;/I&gt;result_df.collect()]&lt;/P&gt;&lt;P&gt;outside the table/view function. Is there and solution to resolve something like that in DLT? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2022 13:36:37 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/dlt-using-the-result-of-one-view-in-another-table-with-collect/m-p/15968#M10212</guid>
      <dc:creator>140015</dc:creator>
      <dc:date>2022-12-19T13:36:37Z</dc:date>
    </item>
  </channel>
</rss>

