Pramiti Docs

Export Copilot

Push semantic models to dbt, Snowflake, Looker, Tableau, and more

pramiti-export-copilot generates and delivers semantic model exports to downstream tools. It converts Pramiti knowledge models into the native formats of dbt, Snowflake, Databricks, Looker, and Tableau.

Install

pip install pramiti-export-copilot

Quick Start

from pramiti_export_copilot import ExportCopilot, DeliveryConfig
from pramiti_export_copilot.backends import InMemoryBackend
from pramiti_export_copilot.delivery_targets import WebhookTarget
 
# Set up backend with model data
backend = InMemoryBackend()
backend.set_model_data("ws-1", {
    "classes": [{"name": "Customer", "table": "customers", "columns": [...]}]
})
 
# Export to dbt YAML and deliver via webhook
copilot = ExportCopilot(backend)
result = copilot.export_and_deliver(
    workspace_id="ws-1",
    format="dbt",
    config=DeliveryConfig(target=WebhookTarget(url="https://your-endpoint.com"))
)

Supported Formats

FormatMethodOutput
dbtget_dbt_yaml()dbt semantic layer YAML
snowflakeget_snowflake_sql()Snowflake SQL DDL + comments
databricksget_databricks_json()Databricks Unity Catalog JSON
lookerget_lookml()LookML view definitions
tableauget_tableau_tds()Tableau TDS connection files

Delivery Targets

WebhookTarget

Delivers exports via HTTP POST:

target = WebhookTarget(url="https://your-endpoint.com", headers={"Authorization": "Bearer ..."})

GitHubTarget

Creates a pull request with the export in a GitHub repository:

target = GitHubTarget(repo="org/repo", branch="main", token="ghp_...")

GitLabTarget

Creates a merge request with the export in a GitLab repository:

target = GitLabTarget(project_id="123", branch="main", token="glpat-...")

DbtCloudTarget

Pushes directly to dbt Cloud:

target = DbtCloudTarget(account_id="123", project_id="456", token="...")

API Reference

ExportCopilot

class ExportCopilot:
    def __init__(self, backend: IModelDataBackend): ...
    def export(self, workspace_id: str, format: str) -> str: ...
    def export_and_deliver(self, workspace_id: str, format: str, config: DeliveryConfig) -> DeliveryResult: ...

IModelDataBackend (Interface)

class IModelDataBackend(ABC):
    def get_model_data(self, workspace_id: str) -> dict: ...
    def get_dbt_yaml(self, workspace_id: str) -> str: ...
    def get_snowflake_sql(self, workspace_id: str) -> str: ...
    def get_databricks_json(self, workspace_id: str) -> str: ...
    def get_lookml(self, workspace_id: str) -> str: ...
    def get_tableau_tds(self, workspace_id: str) -> str: ...

DeliveryResult

@dataclass
class DeliveryResult:
    success: bool
    format: str
    target: str
    content_hash: str    # SHA-256 of delivered content
    delivered_at: str
    error: Optional[str]

On this page