Creating a persistent query history table using the REST API

WWoman
Databricks Partner

Hello all,

I am looking for a way to load a persistent query history table from the query history REST API (including metrics). I do know about the system table system.query.history, but I do not have access to it.

I am looking to create a python script to load this table on a daily basis. Does anyone have code they'd be willing to share?

MoJaMa
Databricks Employee
Databricks Employee

Hi,

Can you check if you have access to this?

https://github.com/dbsys21/lakehouse-tacklebox/tree/main/40-observability/dbsql-query-history-sync

Ideally your organization should enable the system tables and provide the necessary access, so each team doesn't have to reinvent the wheel.