Package: azure-purview-scanning
Azure Purview Scanning client library for PythonAzure Purview Scanning is a fully managed cloud service whose users can scan your data into your data estate (also known as yourcatalog). Scanning is a process by which the catalog connects directly to a data source on a user-specified schedule.Scan your data into your catalogExamine your dataExtract schemas from your dataPlease 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 is ending 01 January 2022. For more information and questions, please refer tohttps://github.com/Azure/azure-sdk-for-python/issues/20691Getting startedPrerequisitesPython 2.7, or 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 Scanning client library for Python withpip:pipinstallazure-purview-scanningAuthenticate 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.scanningimportPurviewScanningClientfromazure.identityimportDefaultAzureCredentialcredential=DefaultAzureCredential()client=PurviewScanningClient(endpoint="https://<my-account-name>.scan.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 list all of your data sources.List All Data SourcesList All Data Sourcesfromazure.purview.scanningimportPurviewScanningClientfromazure.identityimportDefaultAzureCredentialfromazure.core.exceptionsimportHttpResponseErrorcredential=DefaultAzureCredential()client=PurviewScanningClient(endpoint="https://<my-account-name>.scan.purview.azure.com",credential=credential)try:response=client.data_sources.list_all()result=[itemforiteminresponse]print(result)exceptHttpResponseErrorase:print(e)TroubleshootingGeneralThe Purview Scanning client will raise exceptions defined in [Azure Core][azure_core] if 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.scanningimportPurviewScanningClient# 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>.scan.purview.azure.com"credential=DefaultAzureCredential()# This client will log detailed information about its HTTP sessions, at DEBUG levelclient=PurviewScanningClient(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.data_sources.list_all(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.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 Scanning library.