cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Administration & Architecture
Explore discussions on Databricks administration, deployment strategies, and architectural best practices. Connect with administrators and architects to optimize your Databricks environment for performance, scalability, and security.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Any Databricks system tables contain info of the saved/pre-defined queries

BryanC
New Contributor II

How can I find the saved/pre-defined queries in Databricks system tables?

system.query.history seems NOT having the info, like query-id or query-name

5 REPLIES 5

tapash-db
Databricks Employee
Databricks Employee

Hi Bryan, Databricks system tables do not store saved queries. Query history table captures the query execution details, including:

  • Statement ID
  • Execution status
  • User who ran the query
  • Statement text (if not encrypted)
  • Statement type
  • Execution duration
  • Resource usage

BryanC
New Contributor II

How can we retrieve the information from the "query history table" and present it in our own dashboard/widget?

tapash-db
Databricks Employee
Databricks Employee

Hi Bryan, Depending on the information you want to retrieve, you can write queries and showcase that in a dashboard. Please see these links for sample query and dashboard.

https://medium.com/dbsql-sme-engineering/the-new-databricks-sql-warehouse-advisor-dashboard-a89771bb...

https://community.databricks.com/t5/technical-blog/queries-for-cost-attribution-using-system-tables/...

 

BryanC
New Contributor II

That did not address the requirement to show the saved/pre-defined queries in our own dashboard, while the saved/pre-defined queries cannot be identified from system.query.history

tapash-db
Databricks Employee
Databricks Employee

Hi Bryan, As I mentioned in the previous thread, query history doesn't store saved query information. There is no out of the box feature which can showcase saved query in the dashboard. For accessing saved query you can follow these methods. 

  1. Workspace UI: You can view and manage saved queries by clicking on "Workspace" or "Queries" in the sidebar.
  2. Workspace Browser: Queries can be organized into folders along with other Databricks objects in the workspace browser.
     
  3. API and Connectors: You can create and manage queries using the REST API, JDBC/ODBC connectors, or partner tools without using the Databricks UI. 

Please see this link https://learn.microsoft.com/en-us/azure/databricks/sql/user/queries/

 

 

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonโ€™t want to miss the chance to attend and share knowledge.

If there isnโ€™t a group near you, start one and help create a community that brings people together.

Request a New Group