|
| 1 | +# Azure Purview Datamap client library for Python |
| 2 | +Microsoft Purview Data Map provides the foundation for data discovery and data governance. Microsoft Purview Data Map is a cloud native PaaS service that captures metadata about enterprise data present in analytics and operation systems on-premises and cloud. DataMapClient provides a set of APIs in the Purview Data Map service. For a full list of APIs, please refer to [Data Map API](https://learn.microsoft.com/rest/api/purview/datamapdataplane/operation-groups?view=rest-purview-datamapdataplane-2023-09-01). |
| 3 | + |
| 4 | +## Getting started |
| 5 | + |
| 6 | +### Installing the package |
| 7 | + |
| 8 | +```bash |
| 9 | +python -m pip install azure-purview-datamap |
| 10 | +``` |
| 11 | + |
| 12 | +#### Prequisites |
| 13 | + |
| 14 | +- Python 3.8 or later is required to use this package. |
| 15 | +- You need an [Azure subscription][azure_sub] to use this package. |
| 16 | +- An existing Azure Purview Datamap instance. |
| 17 | +#### Create with an Azure Active Directory Credential |
| 18 | +To use an [Azure Active Directory (AAD) token credential][authenticate_with_token], |
| 19 | +provide an instance of the desired credential type obtained from the |
| 20 | +[azure-identity][azure_identity_credentials] library. |
| 21 | + |
| 22 | +To authenticate with AAD, you must first [pip][pip] install [`azure-identity`][azure_identity_pip] |
| 23 | + |
| 24 | +After setup, you can choose which type of [credential][azure_identity_credentials] from azure.identity to use. |
| 25 | +As an example, [DefaultAzureCredential][default_azure_credential] can be used to authenticate the client: |
| 26 | + |
| 27 | +Set the values of the client ID, tenant ID, and client secret of the AAD application as environment variables: |
| 28 | +`AZURE_CLIENT_ID`, `AZURE_TENANT_ID`, `AZURE_CLIENT_SECRET` |
| 29 | + |
| 30 | +Use the returned token credential to authenticate the client: |
| 31 | + |
| 32 | +```python |
| 33 | +>>> from azure.purview.datamap import DataMapClient |
| 34 | +>>> from azure.identity import DefaultAzureCredential |
| 35 | +>>> client = DataMapClient(endpoint='<endpoint>', credential=DefaultAzureCredential()) |
| 36 | +``` |
| 37 | + |
| 38 | +## Key concepts |
| 39 | + |
| 40 | +### Client |
| 41 | + |
| 42 | +This package offers request builders so you can build http requests and send these requests to the service using the `send_request` method. |
| 43 | +For more information on how to use request builders and our clients, see [here][request_builders_and_client]. |
| 44 | + |
| 45 | +## Examples |
| 46 | + |
| 47 | +```python |
| 48 | +>>> from azure.purview.datamap import DataMapClient |
| 49 | +>>> from azure.identity import DefaultAzureCredential |
| 50 | +>>> from azure.core.exceptions import HttpResponseError |
| 51 | + |
| 52 | +>>> client = DataMapClient(endpoint='<endpoint>', credential=DefaultAzureCredential()) |
| 53 | +>>> try: |
| 54 | + client.type_definition.get() |
| 55 | + except HttpResponseError as e: |
| 56 | + print('service responds error: {}'.format(e.response.json())) |
| 57 | + |
| 58 | +``` |
| 59 | + |
| 60 | +## Troubleshooting |
| 61 | + |
| 62 | +## Next steps |
| 63 | + |
| 64 | +For more generic samples, see our [client docs][request_builders_and_client]. |
| 65 | + |
| 66 | +## Contributing |
| 67 | + |
| 68 | +This project welcomes contributions and suggestions. Most contributions require |
| 69 | +you to agree to a Contributor License Agreement (CLA) declaring that you have |
| 70 | +the right to, and actually do, grant us the rights to use your contribution. |
| 71 | +For details, visit https://cla.microsoft.com. |
| 72 | + |
| 73 | +When you submit a pull request, a CLA-bot will automatically determine whether |
| 74 | +you need to provide a CLA and decorate the PR appropriately (e.g., label, |
| 75 | +comment). Simply follow the instructions provided by the bot. You will only |
| 76 | +need to do this once across all repos using our CLA. |
| 77 | + |
| 78 | +This project has adopted the |
| 79 | +[Microsoft Open Source Code of Conduct][code_of_conduct]. For more information, |
| 80 | +see the Code of Conduct FAQ or contact [email protected] with any |
| 81 | +additional questions or comments. |
| 82 | + |
| 83 | +<!-- LINKS --> |
| 84 | +[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/ |
| 85 | +[authenticate_with_token]: https://docs.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-an-authentication-token |
| 86 | +[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#credentials |
| 87 | +[azure_identity_pip]: https://pypi.org/project/azure-identity/ |
| 88 | +[default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential |
| 89 | +[request_builders_and_client]: https://aka.ms/azsdk/python/protocol/quickstart |
| 90 | +[pip]: https://pypi.org/project/pip/ |
| 91 | +[azure_sub]: https://azure.microsoft.com/free/ |
| 92 | + |
0 commit comments