Package: azure-purview-catalog
Azure Purview Catalog client library for PythonAzure 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 termsBrowse associated technical, business, semantic, and operational metadataIdentify the sensitivity level of data.Please rely heavily on theservice's documentationand ourclient docsto use this librarySource code|Package (PyPI)|API reference documentation|Product documentationDisclaimerAzure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer tohttps://github.com/Azure/azure-sdk-for-python/issues/20691Getting startedPrerequisitesPython 3.6 or later is required to use this package.You must have anAzure subscriptionand aPurviewto use this package.Create a Purview ResourceFollowtheseinstructions to create your Purview resourceInstall the packageInstall the Azure Purview Catalog client library for Python withpip:pipinstallazure-purview-catalogAuthenticate the clientTo use anAzure Active Directory (AAD) token credential,
provide an instance of the desired credential type obtained from theazure-identitylibrary.To authenticate with AAD, you must firstpipinstallazure-identityandenable AAD authentication on your Purview resourceAfter setup, you can choose which type ofcredentialfrom azure.identity to use.
As an example,DefaultAzureCredentialcan 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_SECRETUse the returned token credential to authenticate the client:fromazure.purview.catalogimportPurviewCatalogClientfromazure.identityimportDefaultAzureCredentialcredential=DefaultAzureCredential()client=PurviewCatalogClient(endpoint="https://<my-account-name>.purview.azure.com",credential=credential)Key conceptsClientThis package offers request builders so you can build http requests and send these requests to the service using thesend_requestmethod.
For more information on how to use request builders and our clients, seehere.ExamplesThe following section shows you how to initialize and authenticate your client, then get all of your type-defs.Get All Type DefinitionsGet All Type Definitionsfromazure.purview.catalogimportPurviewCatalogClientfromazure.identityimportDefaultAzureCredentialfromazure.core.exceptionsimportHttpResponseErrorcredential=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 definitionsprint(response['entityDefs'])exceptHttpResponseErrorase:print(e)TroubleshootingGeneralThe Purview Catalog client will raise exceptions defined inAzure Coreif you call.raise_for_status()on your responses.LoggingThis library uses the standardlogginglibrary 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 thelogging_enablekeyword argument:importsysimportloggingfromazure.identityimportDefaultAzureCredentialfromazure.purview.catalogimportPurviewCatalogClient# Create a logger for the 'azure' SDKlogger=logging.getLogger('azure')logger.setLevel(logging.DEBUG)# Configure a console outputhandler=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 levelclient=PurviewCatalogClient(endpoint=endpoint,credential=credential,logging_enable=True)Similarly,logging_enablecan enable detailed logging for a singlesend_requestcall,
even when it isn't enabled for the client:result=client.types.get_all_type_definitions(logging_enable=True)Next stepsFor more generic samples, see ourclient docs.ContributingThis 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, visitcla.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 theMicrosoft Open Source Code of Conduct. For more information see theCode of Conduct FAQor contactopencode@microsoft.comwith any additional questions or comments.Release History1.0.0b4 (2022-06-13)FeaturesSupport Atlas 2.2 APIsBugs FixedAdd missing query parameterincludeTermHierarchyfor update term APIAdd missing query parameterexcludeRelationshipTypesfor get term API1.0.0b3 (2022-03-15)Bugs FixedFixdelete_by_guidsto get rid of bad request error #224871.0.0b2 (2021-09-29)FeaturesAdd convenience operations to clientBreaking changesRemove rest layer and request builders(detailed description is inREADME.md)The HttpRequest parameter to send_request has changed fromhttp_requesttorequestOrdering of endpoint and credential params have changed1.0.0b1 (2021-05-11)This is the initial release of the Azure Purview Catalog library.