- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2025 01:57 PM
Here's how you can do it.
import requests
import json
api_endpoint = "https://test-1.cloud.databricks.com/api/2.0/sql/history/queries"
headers = {
"Authorization": "Bearer XXXXXX”
}
params = json.dumps({
"filter_by": {
"user_id": "5342291138747455", # Example filter: queries executed by a specific user
"query_start_time_range": {
"start_time_ms": 1640995200000, # Example start time in milliseconds
"end_time_ms": 1641081599000 # Example end time in milliseconds
}
}
})
response = requests.get(api_endpoint, headers=headers, params=params)
# Parse the response
data = response.json()
print(json.dumps(data, indent=4))