Amundsen Common

raw JSON →
0.32.0 verified Fri Apr 17 auth: no python

Amundsen Common is a Python library providing shared data models, utilities, and abstractions for the various components of the Amundsen data discovery and metadata platform (e.g., Metadata service, Search service, Databuilder, Frontend). It ensures consistency across the ecosystem by defining core entities like Tables, Dashboards, and Users. The current version is 0.32.0, with releases typically synchronized with the broader Amundsen monorepo updates, leading to an irregular release cadence.

pip install amundsen-common
error ModuleNotFoundError: No module named 'amundsen.common.models.table'
cause Incorrect import path. The package name on PyPI is `amundsen-common`, which translates to the top-level Python package `amundsen_common` (with an underscore).
fix
Change the import statement to use amundsen_common: from amundsen_common.models.table import Table.
error AttributeError: 'Table' object has no attribute 'new_field'
cause Attempting to access a field that does not exist in the version of `Table` model currently installed, or has been renamed/removed.
fix
Check the amundsen-common changelog for the installed version. Update your code to use the correct field names or upgrade amundsen-common and associated Amundsen services if the field was recently added.
error TypeError: __init__() got an unexpected keyword argument 'old_field'
cause Passing an unexpected keyword argument during model instantiation, likely due to a field being renamed or removed in a newer `amundsen-common` version.
fix
Consult the amundsen-common documentation or source code for the correct constructor arguments for your installed version. Adjust your instantiation logic to match the current model schema.
gotcha Amundsen Common is part of a larger monorepo. While its versions are managed separately, significant changes often coincide with updates to other Amundsen services (metadata, search, frontend). Ensure compatibility when mixing versions of Amundsen components.
fix Always check the Amundsen release notes and recommended component versions for your specific Amundsen deployment to ensure compatibility across services.
breaking Schema evolution in `amundsen-common` models (e.g., adding, removing, or renaming fields in `Table`, `Dashboard`, `User` objects) can break downstream services (Metadata, Search) or Databuilder jobs that rely on these models for data serialization/deserialization.
fix Review the changelog for `amundsen-common` before upgrading. Update your Amundsen services, Databuilder extractors/loaders, and any custom code to accommodate schema changes. Test thoroughly in a staging environment.
gotcha `amundsen-common` provides abstract models and utilities. It does not include direct database connectivity or API clients. Users interact with these models through other Amundsen components or by implementing their own data access layers.
fix Understand that `amundsen-common` defines the 'what' (data structures), not the 'how' (data persistence or retrieval). For integration with Amundsen services, refer to `amundsen-databuilder`, `amundsen-metadata`, or `amundsen-search` documentation.

This quickstart demonstrates how to import and instantiate core Amundsen Common data models, such as `Table`, and how to use common enumerations like `ResourceType`.

from amundsen_common.models.table import Table
from amundsen_common.entity.resource_type import ResourceType

# Create a Table object
table = Table(
    database='my_database',
    cluster='my_cluster',
    schema_name='public',
    name='users_data',
    description='Contains user login and profile information.',
    uri='my_database://my_cluster/public/users_data'
)

print(f"Created Table: {table.name} from {table.database}.{table.schema_name}")
print(f"Table URI: {table.uri}")

# Using a ResourceType enum
print(f"Resource Type for Table: {ResourceType.Table.name}")
print(f"Resource Type for Dashboard (value): {ResourceType.Dashboard.value}")