Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Azure Purview Catalog client library for Python

Azure Purview Catalog is a fully managed cloud service whose users can discover the data sources they need and understand the data sources they find. At the same time, Data Catalog helps organizations get more value from their existing investments.

  • Search for data using technical or business terms
  • Browse associated technical, business, semantic, and operational metadata
  • Identify the sensitivity level of data.

Please rely heavily on the service's documentation and our client docs to use this library

Source code | Package (PyPI) | API reference documentation| Product documentation

Disclaimer

Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691

Getting started

Prerequisites

  • Python 3.6 or later is required to use this package.
  • You must have an Azure subscription and a Purview to use this package.

Create a Purview Resource

Follow these instructions to create your Purview resource

Install the package

Install the Azure Purview Catalog client library for Python with pip:

pip install azure-purview-catalog

Authenticate the client

To use an Azure Active Directory (AAD) token credential, provide an instance of the desired credential type obtained from the azure-identity library.

To authenticate with AAD, you must first pip install azure-identity and enable AAD authentication on your Purview resource

After setup, you can choose which type of credential from azure.identity to use. As an example, DefaultAzureCredential can be used to authenticate the client:

Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, AZURE_CLIENT_SECRET

Use the returned token credential to authenticate the client:

from azure.purview.catalog import PurviewCatalogClient
from azure.identity import DefaultAzureCredential

credential = DefaultAzureCredential()
client = PurviewCatalogClient(endpoint="https://<my-account-name>.purview.azure.com", credential=credential)

Key concepts

Client

This package offers request builders so you can build http requests and send these requests to the service using the send_request method. For more information on how to use request builders and our clients, see here.

Examples

The following section shows you how to initialize and authenticate your client, then get all of your type-defs.

Get All Type Definitions

from azure.purview.catalog import PurviewCatalogClient
from azure.identity import DefaultAzureCredential
from azure.core.exceptions import HttpResponseError

credential = DefaultAzureCredential()
client = PurviewCatalogClient(endpoint="https://<my-account-name>.purview.azure.com", credential=credential)
try:
    response = client.types.get_all_type_definitions()
    # print out all of your entity definitions
    print(response['entityDefs'])

except HttpResponseError as e:
    print(e)

Troubleshooting

General

The Purview Catalog client will raise exceptions defined in Azure Core if you call .raise_for_status() on your responses.

Logging

This library uses the standard logging library for logging. Basic information about HTTP sessions (URLs, headers, etc.) is logged at INFO level.

Detailed DEBUG level logging, including request/response bodies and unredacted headers, can be enabled on a client with the logging_enable keyword argument:

import sys
import logging
from azure.identity import DefaultAzureCredential
from azure.purview.catalog import PurviewCatalogClient

# Create a logger for the 'azure' SDK
logger = logging.getLogger('azure')
logger.setLevel(logging.DEBUG)

# Configure a console output
handler = logging.StreamHandler(stream=sys.stdout)
logger.addHandler(handler)

endpoint = "https://<my-account-name>.purview.azure.com"
credential = DefaultAzureCredential()

# This client will log detailed information about its HTTP sessions, at DEBUG level
client = PurviewCatalogClient(endpoint=endpoint, credential=credential, logging_enable=True)

Similarly, logging_enable can enable detailed logging for a single send_request call, even when it isn't enabled for the client:

result = client.types.get_all_type_definitions(logging_enable=True)

Next steps

For more generic samples, see our client docs.

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Release History

1.0.0b4 (2022-06-13)

Features

  • Support Atlas 2.2 APIs

Bugs Fixed

  • Add missing query parameter includeTermHierarchy for update term API
  • Add missing query parameter excludeRelationshipTypes for get term API

1.0.0b3 (2022-03-15)

Bugs Fixed

  • Fix delete_by_guids to get rid of bad request error #22487

1.0.0b2 (2021-09-29)

Features

  • Add convenience operations to client

Breaking changes

  • Remove rest layer and request builders(detailed description is in README.md)
  • The HttpRequest parameter to send_request has changed from http_request to request
  • Ordering of endpoint and credential params have changed

1.0.0b1 (2021-05-11)

  • This is the initial release of the Azure Purview Catalog library.

Metadata

Release files for azure-purview-catalog 1.0.0b4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for azure-purview-catalog 1.0.0b4
File Size Uploaded
azure-purview-catalog-1.0.0b4.zip 168.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for azure-purview-catalog 1.0.0b4
File Interpreter ABI Platform
azure_purview_catalog-1.0.0b4-py3-none-any.whl Python 3 none any Details

Total release size: 322.5 kB

Release files / azure-purview-catalog-1.0.0b4.zip

Download URL azure-purview-catalog-1.0.0b4.zip
Size 168.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ba65dcb4fc0ac22d858c63a892ce75e9122340dbb9eeaa571a12ca07f5a119da
BLAKE2b-256 checksum
How to use checksums
d564c15a1eb12ae3de637e034f4a1c00003febcd5cb403311203e9423bbd5f77
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.28.0 setuptools/58.1.0 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.9.13

Release files / azure_purview_catalog-1.0.0b4-py3-none-any.whl

Download URL azure_purview_catalog-1.0.0b4-py3-none-any.whl
Size 154.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
311b63e62835da789823771091935f5af490e9b97f3e85f551d7d4f11914a6ac
BLAKE2b-256 checksum
How to use checksums
5d912d11d805838ee9afa4b981fb7ddca1bdaeb8b675a0019694425b335e9f76
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.28.0 setuptools/58.1.0 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.9.13
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page