2:57 PM
0
Q: List Databricks Catalogs from rest API

AdiTrying to query from c# Catalogs from Databricks hosted on Azure using rest API. Everything else works fines SCHEMES / DATABASES / TABLES. I am using trial version of Databricks, Unity catalog is not enabled and it is non-premium account . SHOW CATALOGS - shows Spark_catalog only (have Hive_metas...

 
It seems like you're encountering limitations with the trial version of Databricks, particularly with accessing catalogs via the REST API. Since the Unity catalog is not enabled and you have a non-premium account, you may not have access to certain features like listing catalogs directly via the REST API.
 
Adi
@VenkatV if I have premium account what would be a proper way to do that ?
 
Are you searching for a method to list all catalogs in your account using only REST API or any scripts?
 
Adi
@VenkatV Any type of script will help.
 
Ok. Like PowerShell?
 
Adi
2:57 PM
@Sampath getting error on second request when populating the proper endpoint Id ``` {"error_code":"ENDPOINT_NOT_FOUND","message":"No API found for 'GET /sql/endpoints/XXXX/Catalogs/'"} ``
@VenkatV PowerShell , yes.
 
Ok, let me check and provide you the script.
token=$(az account get-access-token --resource=2ff814a6-3304-4ab8-85cb-cd0e6f879c1d --query accessToken --output tsv) curl --request GET "workspace url/api/2.1/unity-catalog/metastores" --header "Authorization: Bearer $token" For URL :open your workspace and copy the url of the workspace , starting with URL adb.
 
Adi
@VenkatV This is still Unity Catalog. Need the case where unity catalog is not existing/enabled. public async Task<IEnumerable<Catalog>> List(CancellationToken cancellationToken = default) { var requestUri = $"{BaseUnityCatalogUri}/catalogs"; var catalogsList = await HttpGet<JsonObject>(this.HttpClient, requestUri, cancellationToken).ConfigureAwait(false); catalogsList.TryGetPropertyValue("catalogs", out var catalogs); return catalogs?.Deserialize<IEnumerable<Catalog>>(Options) ?? Enumerable.Empty<Catalog>(); }
 
yes, with Above script, I'm able to fetch Unity Catalog which are not enabled.
 
Adi
@VenkatV Sorry maybe I am expressing wrongly but will try to explain. When you create databricks (using Premium) you get SQL Warheous, two Catalogs : Samples, Hive_Metastore , no unity catalog is setup. So the question is how to get Catalogs which are not part of UC.
 
Ok, You want to print two Catalogs : Samples, Hive_Metastore, which are created by default?
 
Adi
3:11 PM
Ues that is correct
*Yes
 
3:31 PM
As per this Doc: https://docs.databricks.com/api/azure/workspace/workspace/list
We cant list default catalogs which are not enabled, if the meta store is not assigned for the current workspace, you will get the error: No metastore assigned for the current workspace.
 
Adi
Yes that is correct Metastore is not assigned for the workspace.
 
As of now there is no rest API endpoint for same requirement.
We need to check any alternate way for same.
 
Adi
3:46 PM
What is strange is when you use ODBC it is possible to get. This is why it is strange to don't have an option for this.
The same configuration.