<?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 Pull Cached SQL Table into Python Dictionary? in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-to-pull-cached-sql-table-into-python-dictionary/m-p/4275#M1035</link>
    <description>&lt;P&gt;Got it to work, thank you for the tip! I needed to convert the dataframe over to a pandas dataframe&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.geeksforgeeks.org/convert-pyspark-dataframe-to-dictionary-in-python/" target="test_blank"&gt;https://www.geeksforgeeks.org/convert-pyspark-dataframe-to-dictionary-in-python/&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 17 May 2023 14:34:16 GMT</pubDate>
    <dc:creator>drewtoby</dc:creator>
    <dc:date>2023-05-17T14:34:16Z</dc:date>
    <item>
      <title>How to Pull Cached SQL Table into Python Dictionary?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-pull-cached-sql-table-into-python-dictionary/m-p/4273#M1033</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have been working on this issue as a proof of concept - it would be extremely helpful to iterate through tables via loops in a few scenarios. I have a simple three column dimension that I added to a cached table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cache lazy table hedis_cache select * from hofhc.hedis_dim&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I then tried the following two methods. The first is coming up empty, whereas the second is returning data as a dataframe, not a python dictionary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Method 1"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/194i590BBB81C0FE2BAC/image-size/large?v=v2&amp;amp;px=999" role="button" title="Method 1" alt="Method 1" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="Method 2"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/198i4FCAEC0C5AE50870/image-size/large?v=v2&amp;amp;px=999" role="button" title="Method 2" alt="Method 2" /&gt;&lt;/span&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any advice? Thanks in advance for all the help!&lt;/P&gt;</description>
      <pubDate>Tue, 16 May 2023 18:50:10 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-pull-cached-sql-table-into-python-dictionary/m-p/4273#M1033</guid>
      <dc:creator>drewtoby</dc:creator>
      <dc:date>2023-05-16T18:50:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to Pull Cached SQL Table into Python Dictionary?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-pull-cached-sql-table-into-python-dictionary/m-p/4274#M1034</link>
      <description>&lt;P&gt;@Andrew Begg​&amp;nbsp;&lt;/P&gt;&lt;P&gt;First of all, cache table creates a view, not table, so you won't be able to use pd.read_table (https://docs.databricks.com/sql/language-manual/sql-ref-syntax-aux-cache-cache-table.html).&lt;/P&gt;&lt;P&gt;About the second method - .select() still gives a dataframe as an output. You need to find a way to convert DF to dict.&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2023 05:35:44 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-pull-cached-sql-table-into-python-dictionary/m-p/4274#M1034</guid>
      <dc:creator>daniel_sahal</dc:creator>
      <dc:date>2023-05-17T05:35:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to Pull Cached SQL Table into Python Dictionary?</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-pull-cached-sql-table-into-python-dictionary/m-p/4275#M1035</link>
      <description>&lt;P&gt;Got it to work, thank you for the tip! I needed to convert the dataframe over to a pandas dataframe&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.geeksforgeeks.org/convert-pyspark-dataframe-to-dictionary-in-python/" target="test_blank"&gt;https://www.geeksforgeeks.org/convert-pyspark-dataframe-to-dictionary-in-python/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 17 May 2023 14:34:16 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-pull-cached-sql-table-into-python-dictionary/m-p/4275#M1035</guid>
      <dc:creator>drewtoby</dc:creator>
      <dc:date>2023-05-17T14:34:16Z</dc:date>
    </item>
  </channel>
</rss>

