Skip to main content

Collate Python SDK quickstart

Collate uses the openmetadata-ingestion Python package for typed metadata operations. Match the package release line to your Collate server release.

Which Python SDK Should I Use?

The openmetadata-ingestion package contains two Python clients. Both call the same Collate API. For new scripts and jobs, use SDK 2.0. It needs less setup and reads more simply. Use the original client when you need an operation that SDK 2.0 doesn’t offer, or when you maintain existing code that already uses it.

Use Both Clients in One Script

Both ship in the same package, so one script can use both. Set up each one separately: call configure() for SDK 2.0 and build an OpenMetadata client for the original client.

Migrate an Existing Job

Change one call at a time: Tables.create(request) also updates an existing table, the same as create_or_update. Keep these differences in mind:
  • Host URL: In configure(host=...), end the URL with /api, the same as hostPort in the original client. Without /api, the connection fails.
  • Listing: Pass query filters as filters={"databaseSchema": "service.database.schema"}.
  • Authentication: With the original client, set authProvider="openmetadata" when you authenticate with a JWT token. SDK 2.0 doesn’t need an authProvider.
  • Updates: Tables.update(table) sends only the changed fields as a JSON Patch. If nothing changed, it sends no request, doesn’t change the version number, and returns None.

Install the SDK

For Collate 2.0.5, install a package from the matching server patch line:

Configure the connection

Set the Collate API URL and an ingestion bot JSON Web Token (JWT):
Call configure() once when the application starts. Entity classes reuse the configured client.
Pass credentials directly when environment variables aren’t available:

Manage a table

The following example creates, retrieves, updates, and soft-deletes a table. Replace sample_data.ecommerce_db.shopify with the fully qualified name of an existing database schema.
Tables.create() is idempotent. It creates the table when it doesn’t exist and updates it when the fully qualified name already exists. Tables.update() sends only the fields you changed. When no field changed, it makes no request and returns None, so check the result before you read from it.
Avoid hard_delete=True unless permanent removal is intended. Hard deletes can’t be undone.

Next steps