Python SDK for Tessera - Data contract coordination for warehouses
Project description
Tessera Python SDK
Python SDK for Tessera - Data Contract Coordination
Tessera coordinates data contracts between producers and consumers. Producers publish schemas, consumers register dependencies, and breaking changes require acknowledgment before deployment.
This SDK provides a Python client for the Tessera API.
Installation
pip install tessera-sdk
Or with uv:
uv add tessera-sdk
Quick Start
from tessera_sdk import TesseraClient
client = TesseraClient(base_url="http://localhost:8000")
# Create a team
team = client.teams.create(name="data-platform")
# Create an asset
asset = client.assets.create(
fqn="warehouse.analytics.dim_customers",
owner_team_id=team.id
)
# Publish a contract
result = client.assets.publish_contract(
asset_id=asset.id,
schema={
"type": "object",
"properties": {
"id": {"type": "integer"},
"name": {"type": "string"}
}
},
version="1.0.0"
)
# Check impact before making changes
impact = client.assets.check_impact(
asset_id=asset.id,
proposed_schema={
"type": "object",
"properties": {
"id": {"type": "string"}, # Changed type!
"name": {"type": "string"}
}
}
)
if not impact.safe_to_publish:
print(f"Breaking changes detected: {impact.breaking_changes}")
Features
- Sync and async clients - Use
TesseraClientorAsyncTesseraClient - Type-safe - Full Pydantic model support
- Error handling - Typed exceptions for API errors
- Flexible configuration - Environment variables or explicit config
Async Support
import asyncio
from tessera_sdk import AsyncTesseraClient
async def main():
async with AsyncTesseraClient() as client:
team = await client.teams.create(name="data-platform")
print(f"Created team: {team.name}")
asyncio.run(main())
Airflow Integration
from airflow.decorators import task
from tessera_sdk import TesseraClient
@task
def validate_schema():
client = TesseraClient()
impact = client.assets.check_impact(
asset_id="your-asset-id",
proposed_schema=load_schema("./schema.json")
)
if not impact.safe_to_publish:
raise ValueError(f"Breaking changes: {impact.breaking_changes}")
@task
def publish_contract():
client = TesseraClient()
client.assets.publish_contract(
asset_id="your-asset-id",
schema=load_schema("./schema.json"),
version=get_version()
)
API Reference
TesseraClient
The main client class with the following resources:
| Resource | Description |
|---|---|
client.teams |
Team management |
client.assets |
Asset and contract management |
client.contracts |
Contract lookup and comparison |
client.registrations |
Consumer registration |
client.proposals |
Breaking change proposals |
Configuration
# Explicit URL
client = TesseraClient(base_url="http://localhost:8000")
# Environment variable (TESSERA_URL)
client = TesseraClient() # Uses TESSERA_URL or defaults to localhost:8000
# With authentication
client = TesseraClient(
base_url="http://localhost:8000",
api_key="your-api-key",
timeout=30.0
)
Error Handling
from tessera_sdk import TesseraClient, NotFoundError, ValidationError
client = TesseraClient()
try:
team = client.teams.get("non-existent-id")
except NotFoundError:
print("Team not found")
except ValidationError as e:
print(f"Validation error: {e.message}")
Requirements
- Python 3.10+
- httpx >= 0.25.0
- pydantic >= 2.0.0
Related
- Tessera Server - The Tessera API server
- Tessera Documentation - Full documentation
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tessera_sdk-0.1.3.tar.gz.
File metadata
- Download URL: tessera_sdk-0.1.3.tar.gz
- Upload date:
- Size: 862.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ae9b20149d71ab825eeabdfdd8383c9b4122ade3eb5530543905049adccccbe
|
|
| MD5 |
de0bfa7c32da6133cefd42d0f83af7f8
|
|
| BLAKE2b-256 |
b0c0306f906747a5ce1d2ba3423aa3360a09dd2c7367044a5ca1538311aef23e
|
Provenance
The following attestation bundles were made for tessera_sdk-0.1.3.tar.gz:
Publisher:
publish.yml on ashita-ai/tessera-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tessera_sdk-0.1.3.tar.gz -
Subject digest:
2ae9b20149d71ab825eeabdfdd8383c9b4122ade3eb5530543905049adccccbe - Sigstore transparency entry: 780902992
- Sigstore integration time:
-
Permalink:
ashita-ai/tessera-python@baf6f576c4ac990de7f63c798f8021366c2d4d89 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/ashita-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@baf6f576c4ac990de7f63c798f8021366c2d4d89 -
Trigger Event:
release
-
Statement type:
File details
Details for the file tessera_sdk-0.1.3-py3-none-any.whl.
File metadata
- Download URL: tessera_sdk-0.1.3-py3-none-any.whl
- Upload date:
- Size: 12.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b73032bd98dc3da3cfbc0a493377c8f473312e7d74e94ee655d26e1c441bd6c6
|
|
| MD5 |
73267e35aec3bfc268e517688388e914
|
|
| BLAKE2b-256 |
9134164c113d052cfc14abd1c75d96db23cf432dba4ba6a0c8b364c626be69fc
|
Provenance
The following attestation bundles were made for tessera_sdk-0.1.3-py3-none-any.whl:
Publisher:
publish.yml on ashita-ai/tessera-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tessera_sdk-0.1.3-py3-none-any.whl -
Subject digest:
b73032bd98dc3da3cfbc0a493377c8f473312e7d74e94ee655d26e1c441bd6c6 - Sigstore transparency entry: 780902993
- Sigstore integration time:
-
Permalink:
ashita-ai/tessera-python@baf6f576c4ac990de7f63c798f8021366c2d4d89 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/ashita-ai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@baf6f576c4ac990de7f63c798f8021366c2d4d89 -
Trigger Event:
release
-
Statement type: