Amundsen Common
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.
Common errors
-
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).fixChange the import statement to use `amundsen_common`: `from amundsen_common.models.table import Table`. -
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.fixCheck 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. -
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.fixConsult 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.
Warnings
- 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.
- 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.
- 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.
Install
-
pip install amundsen-common
Imports
- Table
from amundsen_common.models.table import Table
- Dashboard
from amundsen_common.models.dashboard import Dashboard
- ResourceType
from amundsen_common.entity.resource_type import ResourceType
- User
from amundsen_common.models.user import User
Quickstart
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}")