Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mgyucht committed Jan 26, 2024
1 parent 57340de commit 5e72c63
Show file tree
Hide file tree
Showing 92 changed files with 221 additions and 182 deletions.
4 changes: 2 additions & 2 deletions docs/account/access_control.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Account Access Control
======================
``a.access_control``: Account Access Control
============================================
.. currentmodule:: databricks.sdk.service.iam

.. py:class:: AccountAccessControlAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/account/billable_usage.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Billable usage download
=======================
``a.billable_usage``: Billable usage download
=============================================
.. currentmodule:: databricks.sdk.service.billing

.. py:class:: BillableUsageAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/account/budgets.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Budgets
=======
``a.budgets``: Budgets
======================
.. currentmodule:: databricks.sdk.service.billing

.. py:class:: BudgetsAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/account/credentials.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Credential configurations
=========================
``a.credentials``: Credential configurations
============================================
.. currentmodule:: databricks.sdk.service.provisioning

.. py:class:: CredentialsAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/account/custom_app_integration.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
OAuth Custom App Integration
============================
``a.custom_app_integration``: OAuth Custom App Integration
==========================================================
.. currentmodule:: databricks.sdk.service.oauth2

.. py:class:: CustomAppIntegrationAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/account/encryption_keys.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Key configurations
==================
``a.encryption_keys``: Key configurations
=========================================
.. currentmodule:: databricks.sdk.service.provisioning

.. py:class:: EncryptionKeysAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/account/groups.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Account Groups
==============
``a.groups``: Account Groups
============================
.. currentmodule:: databricks.sdk.service.iam

.. py:class:: AccountGroupsAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/account/ip_access_lists.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Account IP Access Lists
=======================
``a.ip_access_lists``: Account IP Access Lists
==============================================
.. currentmodule:: databricks.sdk.service.settings

.. py:class:: AccountIpAccessListsAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/account/log_delivery.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Log delivery configurations
===========================
``a.log_delivery``: Log delivery configurations
===============================================
.. currentmodule:: databricks.sdk.service.billing

.. py:class:: LogDeliveryAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/account/metastore_assignments.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Account Metastore Assignments
=============================
``a.metastore_assignments``: Account Metastore Assignments
==========================================================
.. currentmodule:: databricks.sdk.service.catalog

.. py:class:: AccountMetastoreAssignmentsAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/account/metastores.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Account Metastores
==================
``a.metastores``: Account Metastores
====================================
.. currentmodule:: databricks.sdk.service.catalog

.. py:class:: AccountMetastoresAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/account/network_connectivity.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Network Connectivity
====================
``a.network_connectivity``: Network Connectivity
================================================
.. currentmodule:: databricks.sdk.service.settings

.. py:class:: NetworkConnectivityAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/account/networks.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Network configurations
======================
``a.networks``: Network configurations
======================================
.. currentmodule:: databricks.sdk.service.provisioning

.. py:class:: NetworksAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/account/o_auth_published_apps.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
OAuth Published App
===================
``a.o_auth_published_apps``: OAuth Published App
================================================
.. currentmodule:: databricks.sdk.service.oauth2

.. py:class:: OAuthPublishedAppsAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/account/private_access.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Private Access Settings
=======================
``a.private_access``: Private Access Settings
=============================================
.. currentmodule:: databricks.sdk.service.provisioning

.. py:class:: PrivateAccessAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/account/published_app_integration.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
OAuth Published App Integration
===============================
``a.published_app_integration``: OAuth Published App Integration
================================================================
.. currentmodule:: databricks.sdk.service.oauth2

.. py:class:: PublishedAppIntegrationAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/account/service_principal_secrets.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Service Principal Secrets
=========================
``a.service_principal_secrets``: Service Principal Secrets
==========================================================
.. currentmodule:: databricks.sdk.service.oauth2

.. py:class:: ServicePrincipalSecretsAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/account/service_principals.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Account Service Principals
==========================
``a.service_principals``: Account Service Principals
====================================================
.. currentmodule:: databricks.sdk.service.iam

.. py:class:: AccountServicePrincipalsAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/account/settings.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Personal Compute Enablement
===========================
``a.settings``: Personal Compute Enablement
===========================================
.. currentmodule:: databricks.sdk.service.settings

.. py:class:: AccountSettingsAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/account/storage.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Storage configurations
======================
``a.storage``: Storage configurations
=====================================
.. currentmodule:: databricks.sdk.service.provisioning

.. py:class:: StorageAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/account/storage_credentials.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Account Storage Credentials
===========================
``a.storage_credentials``: Account Storage Credentials
======================================================
.. currentmodule:: databricks.sdk.service.catalog

.. py:class:: AccountStorageCredentialsAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/account/users.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Account Users
=============
``a.users``: Account Users
==========================
.. currentmodule:: databricks.sdk.service.iam

.. py:class:: AccountUsersAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/account/vpc_endpoints.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
VPC Endpoint Configurations
===========================
``a.vpc_endpoints``: VPC Endpoint Configurations
================================================
.. currentmodule:: databricks.sdk.service.provisioning

.. py:class:: VpcEndpointsAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/account/workspace_assignment.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Workspace Assignment
====================
``a.workspace_assignment``: Workspace Assignment
================================================
.. currentmodule:: databricks.sdk.service.iam

.. py:class:: WorkspaceAssignmentAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/account/workspaces.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Workspaces
==========
``a.workspaces``: Workspaces
============================
.. currentmodule:: databricks.sdk.service.provisioning

.. py:class:: WorkspacesAPI
Expand Down
8 changes: 6 additions & 2 deletions docs/gen-client-docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def as_rst(self, usage) -> str:

@dataclass
class ServiceDoc:
client_prefix: str
service_name: str
class_name: str
methods: list[MethodDoc]
Expand All @@ -90,8 +91,9 @@ class ServiceDoc:
def as_rst(self) -> str:
if not self.doc:
self.doc = ''
title = f'``{self.client_prefix}.{self.service_name}``: {self.tag.name}'
out = [
self.tag.name, '=' * len(self.tag.name),
title, '=' * len(title),
f'.. currentmodule:: databricks.sdk.service.{self.tag.package.name}', '',
f'.. py:class:: {self.class_name}', '', f' {self.doc}'
]
Expand Down Expand Up @@ -274,6 +276,7 @@ def class_methods(self, inst) -> list[MethodDoc]:
return method_docs

def service_docs(self, client_inst) -> list[ServiceDoc]:
client_prefix = 'w' if isinstance(client_inst, WorkspaceClient) else 'a'
ignore_client_fields = ('config', 'dbutils', 'api_client', 'files')
all = []
for service_name, service_inst in inspect.getmembers(client_inst):
Expand All @@ -284,7 +287,8 @@ def service_docs(self, client_inst) -> list[ServiceDoc]:
class_doc = service_inst.__doc__
class_name = service_inst.__class__.__name__
all.append(
ServiceDoc(service_name=service_name,
ServiceDoc(client_prefix=client_prefix,
service_name=service_name,
class_name=class_name,
doc=class_doc,
tag=self._get_tag_name(service_inst.__class__.__name__, service_name),
Expand Down
35 changes: 35 additions & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,41 @@ followed by
dbutils.library.restartPython()
```

## Usage Overview

At its core, the SDK exposes two primary clients: `databricks.sdk.WorkspaceClient` and `databricks.sdk.AccountClient`. The `WorkspaceClient` is tailored for interacting with resources within the Databricks workspace, such as notebooks, jobs, and clusters, while the `AccountClient` focuses on account-level functionalities including user and group management, billing, and workspace provisioning and management.

To use the SDK to call an API, first find the API in either the [Workspace API Reference](workspace/index.rst) or [Account API reference](account/index.rst). Then, on the appropriate client, call the corresponding method. All API calls have the form

```
w.<SERVICE>.<METHOD>(<parameters>)
```
or
```
a.<SERVICE>.<METHOD>(parameters)
```

For example, to list all SQL queries in the workspace, run:

```python
# Authenticate as described above
from databricks.sdk import WorkspaceClient
w = WorkspaceClient()
for query in w.queries.list():
print(f'query {query.name} was created at {query.created_at}')
```

To list all workspaces in the account, run:

```python
# Authenticate as described above
from databricks.sdk import AccountClient
a = AccountClient()
for workspace in a.workspaces.list():
print(f'workspace {workspace.workspace_name} was created at {workspace.creation_time}')
```


## Authentication

There are two primary entry points to the Databricks SDK:
Expand Down
4 changes: 2 additions & 2 deletions docs/workspace/account_access_control_proxy.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Account Access Control Proxy
============================
``w.account_access_control_proxy``: Account Access Control Proxy
================================================================
.. currentmodule:: databricks.sdk.service.iam

.. py:class:: AccountAccessControlProxyAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/workspace/alerts.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Alerts
======
``w.alerts``: Alerts
====================
.. currentmodule:: databricks.sdk.service.sql

.. py:class:: AlertsAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/workspace/apps.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Databricks Apps
===============
``w.apps``: Databricks Apps
===========================
.. currentmodule:: databricks.sdk.service.serving

.. py:class:: AppsAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/workspace/artifact_allowlists.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Artifact Allowlists
===================
``w.artifact_allowlists``: Artifact Allowlists
==============================================
.. currentmodule:: databricks.sdk.service.catalog

.. py:class:: ArtifactAllowlistsAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/workspace/catalogs.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Catalogs
========
``w.catalogs``: Catalogs
========================
.. currentmodule:: databricks.sdk.service.catalog

.. py:class:: CatalogsAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/workspace/clean_rooms.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Clean Rooms
===========
``w.clean_rooms``: Clean Rooms
==============================
.. currentmodule:: databricks.sdk.service.sharing

.. py:class:: CleanRoomsAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/workspace/cluster_policies.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Cluster Policies
================
``w.cluster_policies``: Cluster Policies
========================================
.. currentmodule:: databricks.sdk.service.compute

.. py:class:: ClusterPoliciesAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/workspace/clusters.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Clusters
========
``w.clusters``: Clusters
========================
.. currentmodule:: databricks.sdk.service.compute

.. py:class:: ClustersExt
Expand Down
4 changes: 2 additions & 2 deletions docs/workspace/command_execution.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Command Execution
=================
``w.command_execution``: Command Execution
==========================================
.. currentmodule:: databricks.sdk.service.compute

.. py:class:: CommandExecutionAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/workspace/connections.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Connections
===========
``w.connections``: Connections
==============================
.. currentmodule:: databricks.sdk.service.catalog

.. py:class:: ConnectionsAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/workspace/credentials_manager.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Credentials Manager
===================
``w.credentials_manager``: Credentials Manager
==============================================
.. currentmodule:: databricks.sdk.service.settings

.. py:class:: CredentialsManagerAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/workspace/current_user.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CurrentUser
===========
``w.current_user``: CurrentUser
===============================
.. currentmodule:: databricks.sdk.service.iam

.. py:class:: CurrentUserAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/workspace/dashboard_widgets.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Dashboard Widgets
=================
``w.dashboard_widgets``: Dashboard Widgets
==========================================
.. currentmodule:: databricks.sdk.service.sql

.. py:class:: DashboardWidgetsAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/workspace/dashboards.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Dashboards
==========
``w.dashboards``: Dashboards
============================
.. currentmodule:: databricks.sdk.service.sql

.. py:class:: DashboardsAPI
Expand Down
4 changes: 2 additions & 2 deletions docs/workspace/data_sources.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Data Sources
============
``w.data_sources``: Data Sources
================================
.. currentmodule:: databricks.sdk.service.sql

.. py:class:: DataSourcesAPI
Expand Down
Loading

0 comments on commit 5e72c63

Please sign in to comment.