<?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: Duplicate queryId in the query history api response in Get Started Discussions</title>
    <link>https://community.databricks.com/t5/get-started-discussions/duplicate-queryid-in-the-query-history-api-response/m-p/51005#M6123</link>
    <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;you can use SDK from your DataBricks notebook. Here comes example how can you do that:&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;%pip install databricks-sdk --upgrade&amp;lt;div&amp;gt;&amp;lt;span&amp;gt;Restart Python kernel&amp;lt;li-code lang="markup"&amp;gt;dbutils.library.restartPython()&amp;lt;p&amp;gt;List your queries history:&amp;lt;li-code lang="markup"&amp;gt;from databricks.sdk import WorkspaceClient
w = WorkspaceClient()

for q in w.query_history.list():
    print(f"Query: {q.as_dict()['query_id']} \nStart Time: {q.as_dict()['query_start_time_ms']} \
        \nQuery text: {q.as_dict()['query_text']}\n")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Everything in the same notebook.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Good luck&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 12 Nov 2023 22:31:28 GMT</pubDate>
    <dc:creator>Emil_Kaminski</dc:creator>
    <dc:date>2023-11-12T22:31:28Z</dc:date>
    <item>
      <title>Duplicate queryId in the query history api response</title>
      <link>https://community.databricks.com/t5/get-started-discussions/duplicate-queryid-in-the-query-history-api-response/m-p/50970#M6122</link>
      <description>&lt;P&gt;Hello Experts,&lt;/P&gt;&lt;P&gt;I was using the `&lt;SPAN&gt;/api/2.0/sql/history/queries` end-point to find the historical stats for queries on the warehouse endpoint.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;I am surprised to see exact rows duplicated in the response, even though they have different `next_page_token`&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do you suggest to avoid this, so that I get the actual stats about queries that leverage SQL endpoint&lt;/P&gt;&lt;P&gt;Reference link - &lt;A href="https://docs.databricks.com/api/workspace/queryhistory/list" target="_blank"&gt;https://docs.databricks.com/api/workspace/queryhistory/list&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 12 Nov 2023 16:01:58 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/duplicate-queryid-in-the-query-history-api-response/m-p/50970#M6122</guid>
      <dc:creator>tanmoy-km</dc:creator>
      <dc:date>2023-11-12T16:01:58Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate queryId in the query history api response</title>
      <link>https://community.databricks.com/t5/get-started-discussions/duplicate-queryid-in-the-query-history-api-response/m-p/51005#M6123</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;you can use SDK from your DataBricks notebook. Here comes example how can you do that:&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;%pip install databricks-sdk --upgrade&amp;lt;div&amp;gt;&amp;lt;span&amp;gt;Restart Python kernel&amp;lt;li-code lang="markup"&amp;gt;dbutils.library.restartPython()&amp;lt;p&amp;gt;List your queries history:&amp;lt;li-code lang="markup"&amp;gt;from databricks.sdk import WorkspaceClient
w = WorkspaceClient()

for q in w.query_history.list():
    print(f"Query: {q.as_dict()['query_id']} \nStart Time: {q.as_dict()['query_start_time_ms']} \
        \nQuery text: {q.as_dict()['query_text']}\n")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Everything in the same notebook.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Good luck&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 12 Nov 2023 22:31:28 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/duplicate-queryid-in-the-query-history-api-response/m-p/51005#M6123</guid>
      <dc:creator>Emil_Kaminski</dc:creator>
      <dc:date>2023-11-12T22:31:28Z</dc:date>
    </item>
    <item>
      <title>Re: Duplicate queryId in the query history api response</title>
      <link>https://community.databricks.com/t5/get-started-discussions/duplicate-queryid-in-the-query-history-api-response/m-p/51006#M6124</link>
      <description>&lt;P&gt;Sorry for formatting. This editor drives me crazy. Python code once again:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;#Install SDK first
%pip install databricks-sdk --upgrade

#Restart Python kernel
dbutils.library.restartPython() 

#List your queries history:
from databricks.sdk import WorkspaceClient 
w = WorkspaceClient() 
for q in w.query_history.list(): 
    print(f"Query: {q.as_dict()['query_id']} \nStart Time: {q.as_dict()['query_start_time_ms']} \nQuery text: {q.as_dict()['query_text']}\n") &lt;/LI-CODE&gt;</description>
      <pubDate>Sun, 12 Nov 2023 22:33:49 GMT</pubDate>
      <guid>https://community.databricks.com/t5/get-started-discussions/duplicate-queryid-in-the-query-history-api-response/m-p/51006#M6124</guid>
      <dc:creator>Emil_Kaminski</dc:creator>
      <dc:date>2023-11-12T22:33:49Z</dc:date>
    </item>
  </channel>
</rss>

