Atlan Python Client

9.4.0 · active · verified Tue Apr 14

The `pyatlan` library is the official Python SDK for interacting with Atlan, a data governance and metadata management platform. It provides typed wrappers around the Atlan REST API, enabling users to programmatically search, discover, govern, and manage various data assets like tables, dashboards, and glossary terms. The current version, 9.4.0, includes experimental features for the next-generation `pyatlan_v9` and ongoing quality-of-life improvements. The library maintains an active release cadence with frequent updates.

Warnings

Install

Imports

Quickstart

Initializes the `AtlanClient` using API key authentication (preferably from environment variables) and performs a basic search for active Table assets.

import os
from pyatlan.client import AtlanClient
from pyatlan.model.fluent_search import FluentSearch
from pyatlan.model.assets import Table

# Configure with environment variables (recommended) or direct parameters
ATLAN_BASE_URL = os.environ.get('ATLAN_BASE_URL', 'https://<your-tenant>.atlan.com')
ATLAN_API_KEY = os.environ.get('ATLAN_API_KEY', 'YOUR_API_KEY') # Assign persona(s) to API token for access

if not ATLAN_API_KEY or 'YOUR_API_KEY' in ATLAN_API_KEY:
    raise ValueError("Please set ATLAN_API_KEY environment variable or replace 'YOUR_API_KEY' with your actual key.")
if not ATLAN_BASE_URL or '<your-tenant>' in ATLAN_BASE_URL:
    raise ValueError("Please set ATLAN_BASE_URL environment variable or replace '<your-tenant>.atlan.com' with your actual Atlan URL.")

try:
    client = AtlanClient(base_url=ATLAN_BASE_URL, api_key=ATLAN_API_KEY)
    
    # Example: Search for active Table assets
    search_request = (
        FluentSearch()
        .where(FluentSearch.asset_type(Table))
        .where(FluentSearch.active_assets())
        .page_size(10)
        .to_request()
    )
    response = client.asset.search(search_request)

    print(f"Found {len(response.assets)} active Tables:")
    for asset in response.assets:
        print(f"  - {asset.name} ({asset.qualified_name})")

except Exception as e:
    print(f"An error occurred: {e}")

view raw JSON →