<?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: Integrating PySpark DataFrame into SQL Dashboard for Enhanced Visualization in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/integrating-pyspark-dataframe-into-sql-dashboard-for-enhanced/m-p/104935#M41942</link>
    <description>&lt;P&gt;Sorry, I vaugely remember we used to create persistent views on dataframe earlier.&lt;/P&gt;&lt;P&gt;Currently, spark dataframe doesn't allow you to create pesistent view on dataframe, rather you have to create table to use it in SQL warehouse.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# Assuming there is an existing table named 'existing_table'
df = spark.table("system.information_schema.catalog_privileges")

df.createOrReplaceTempView("temp_view") # Temp View at sesion levle, once session is closed, the view is dropped
df.createOrReplaceGlobalTempView("gbl_temp_view") # Global Temp View accessible across all sessions, even if the current session is closed, the view is still accessible.

spark.table("global_temp.gbl_temp_view").display()&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hariprasad_0-1736426924611.png" style="width: 722px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/13976iB99478EE4EFCF129/image-dimensions/722x451?v=v2" width="722" height="451" role="button" title="hariprasad_0-1736426924611.png" alt="hariprasad_0-1736426924611.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;And you cannot create persistant view on top of dataframe or temp-view, which throws error.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hariprasad_1-1736427069415.png" style="width: 724px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/13977iC75A3FCF981E70F9/image-dimensions/724x238?v=v2" width="724" height="238" role="button" title="hariprasad_1-1736427069415.png" alt="hariprasad_1-1736427069415.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Instead, you can create view on tables (even joins) directly which can be accessed in SQL warehouse, but you have to recreate the spark logic into SQL for that you can leverage Databricks Assitance to convert it with less effort.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;create
or replace view hive_metastore.labuser8777982_1736395171_wa99_da_adewd_lab.sys_catalog_privileges_new as
select *
from system.information_schema.catalog_privileges -- this is actual table in system schema
where privilege_type = 'EXECUTE'&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hariprasad_2-1736427349716.png" style="width: 722px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/13978i988500B36239CB0F/image-dimensions/722x210?v=v2" width="722" height="210" role="button" title="hariprasad_2-1736427349716.png" alt="hariprasad_2-1736427349716.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Hari Prasad.&lt;/P&gt;</description>
    <pubDate>Thu, 09 Jan 2025 12:58:29 GMT</pubDate>
    <dc:creator>hari-prasad</dc:creator>
    <dc:date>2025-01-09T12:58:29Z</dc:date>
    <item>
      <title>Integrating PySpark DataFrame into SQL Dashboard for Enhanced Visualization</title>
      <link>https://community.databricks.com/t5/data-engineering/integrating-pyspark-dataframe-into-sql-dashboard-for-enhanced/m-p/104845#M41901</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I have created a DataFrame in a notebook using PySpark and am considering creating a fully-featured dashboard in SQL. My question is whether I need to first store the DataFrame as a table in order to use it in the dashboard, or if it's possible to directly use the DataFrame without storing it as table. While I attempted to display data and create visuals directly from the notebook, I noticed that this approach lacks some of the robust features available in an SQL dashboard. Could you advise on the best approach to integrate the DataFrame into a feature-rich SQL dashboard?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2025 06:27:11 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/integrating-pyspark-dataframe-into-sql-dashboard-for-enhanced/m-p/104845#M41901</guid>
      <dc:creator>amarnathpal</dc:creator>
      <dc:date>2025-01-09T06:27:11Z</dc:date>
    </item>
    <item>
      <title>Re: Integrating PySpark DataFrame into SQL Dashboard for Enhanced Visualization</title>
      <link>https://community.databricks.com/t5/data-engineering/integrating-pyspark-dataframe-into-sql-dashboard-for-enhanced/m-p/104848#M41903</link>
      <description>&lt;P&gt;To integrate a PySpark DataFrame into a feature-rich SQL dashboard, it's best to store the DataFrame as a table in your database. This allows you to use SQL for complex queries and leverages the advanced features of SQL dashboards. Simply write the DataFrame to a SQL database table and connect your dashboard tool (like Tableau or Power BI) to that database. This ensures data persistence and compatibility with robust visualization tools.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2025 06:57:26 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/integrating-pyspark-dataframe-into-sql-dashboard-for-enhanced/m-p/104848#M41903</guid>
      <dc:creator>norma44shah</dc:creator>
      <dc:date>2025-01-09T06:57:26Z</dc:date>
    </item>
    <item>
      <title>Re: Integrating PySpark DataFrame into SQL Dashboard for Enhanced Visualization</title>
      <link>https://community.databricks.com/t5/data-engineering/integrating-pyspark-dataframe-into-sql-dashboard-for-enhanced/m-p/104856#M41906</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.databricks.com/t5/user/viewprofilepage/user-id/141803"&gt;@amarnathpal&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;You can create a View (permanent view) on top dataframe which you can leverage in any SQL Dashboard. The View created will hold the logic of dataframe used to perform transformation.&lt;/P&gt;&lt;P&gt;Also, you can create materialized view, which are preferred for Dashboard scenarios.&lt;/P&gt;&lt;P&gt;&lt;A href="https://spark.apache.org/docs/latest/api/python/reference/pyspark.sql/api/pyspark.sql.DataFrame.createOrReplaceGlobalTempView.html?highlight=view#pyspark.sql.DataFrame.createOrReplaceGlobalTempView" target="_blank" rel="noopener"&gt;pyspark.sql.DataFrame.createOrReplaceGlobalTempView — PySpark 3.5.4 documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Hari Prasad&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2025 07:38:28 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/integrating-pyspark-dataframe-into-sql-dashboard-for-enhanced/m-p/104856#M41906</guid>
      <dc:creator>hari-prasad</dc:creator>
      <dc:date>2025-01-09T07:38:28Z</dc:date>
    </item>
    <item>
      <title>Re: Integrating PySpark DataFrame into SQL Dashboard for Enhanced Visualization</title>
      <link>https://community.databricks.com/t5/data-engineering/integrating-pyspark-dataframe-into-sql-dashboard-for-enhanced/m-p/104865#M41910</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Could you guide me on how to store a view in a table? For example, if I create a view table in a notebook, how can I locate it using an SQL editor later?&lt;BR /&gt;&lt;/SPAN&gt;ex: i have created this in notebook&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;active__df.createOrReplaceTempView("active_view")&lt;/STRONG&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Thu, 09 Jan 2025 08:40:22 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/integrating-pyspark-dataframe-into-sql-dashboard-for-enhanced/m-p/104865#M41910</guid>
      <dc:creator>amarnathpal</dc:creator>
      <dc:date>2025-01-09T08:40:22Z</dc:date>
    </item>
    <item>
      <title>Re: Integrating PySpark DataFrame into SQL Dashboard for Enhanced Visualization</title>
      <link>https://community.databricks.com/t5/data-engineering/integrating-pyspark-dataframe-into-sql-dashboard-for-enhanced/m-p/104935#M41942</link>
      <description>&lt;P&gt;Sorry, I vaugely remember we used to create persistent views on dataframe earlier.&lt;/P&gt;&lt;P&gt;Currently, spark dataframe doesn't allow you to create pesistent view on dataframe, rather you have to create table to use it in SQL warehouse.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;# Assuming there is an existing table named 'existing_table'
df = spark.table("system.information_schema.catalog_privileges")

df.createOrReplaceTempView("temp_view") # Temp View at sesion levle, once session is closed, the view is dropped
df.createOrReplaceGlobalTempView("gbl_temp_view") # Global Temp View accessible across all sessions, even if the current session is closed, the view is still accessible.

spark.table("global_temp.gbl_temp_view").display()&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hariprasad_0-1736426924611.png" style="width: 722px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/13976iB99478EE4EFCF129/image-dimensions/722x451?v=v2" width="722" height="451" role="button" title="hariprasad_0-1736426924611.png" alt="hariprasad_0-1736426924611.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;And you cannot create persistant view on top of dataframe or temp-view, which throws error.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hariprasad_1-1736427069415.png" style="width: 724px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/13977iC75A3FCF981E70F9/image-dimensions/724x238?v=v2" width="724" height="238" role="button" title="hariprasad_1-1736427069415.png" alt="hariprasad_1-1736427069415.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Instead, you can create view on tables (even joins) directly which can be accessed in SQL warehouse, but you have to recreate the spark logic into SQL for that you can leverage Databricks Assitance to convert it with less effort.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;create
or replace view hive_metastore.labuser8777982_1736395171_wa99_da_adewd_lab.sys_catalog_privileges_new as
select *
from system.information_schema.catalog_privileges -- this is actual table in system schema
where privilege_type = 'EXECUTE'&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="hariprasad_2-1736427349716.png" style="width: 722px;"&gt;&lt;img src="https://community.databricks.com/t5/image/serverpage/image-id/13978i988500B36239CB0F/image-dimensions/722x210?v=v2" width="722" height="210" role="button" title="hariprasad_2-1736427349716.png" alt="hariprasad_2-1736427349716.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Hari Prasad.&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jan 2025 12:58:29 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/integrating-pyspark-dataframe-into-sql-dashboard-for-enhanced/m-p/104935#M41942</guid>
      <dc:creator>hari-prasad</dc:creator>
      <dc:date>2025-01-09T12:58:29Z</dc:date>
    </item>
  </channel>
</rss>

