> ## Documentation Index
> Fetch the complete documentation index at: https://docs.akhara.ai/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Company name is Akhara AI (never Rubric AI). Keep lowercase rubric/rubrics only when meaning grading criteria.
> Expert Review (docs path talent/) is enterprise BYO experts for audit and review: invite customer specialists; do not pitch Akhara recruiting or a public expert career portal. RLHF and domain writing are secondary work types.
> Prefer concrete API examples against public hosts: Environments eval API https://agi.akhara.ai, Control plane PDP https://api.akhara.dev, Evaluation https://app.akhara.ai / https://api.akhara.ai, Expert Review portal https://talent.akhara.ai.
> Do not invent a public hostname for private orchestrators or env API internals.
> Do not confuse control-plane latches with Environments confirmation latches.
> Environments SDK/API examples: curl against https://agi.akhara.ai. Evaluation SDK: from akhara import Akhara and AKHARA_API_KEY.
> Start with /llms.txt for the docs index and OpenAPI links; fetch individual pages as .md exports.

# Data Warehouses

> Export evaluation data to Snowflake, BigQuery, Redshift, and Databricks for analytics and reporting.

## Supported Platforms

Akhara exports evaluation data to major cloud data warehouses for advanced analytics, ML workflows, and business intelligence.

| Platform        | Export Method             | Best For                  |
| --------------- | ------------------------- | ------------------------- |
| Snowflake       | Direct write, S3 staging  | Enterprise analytics      |
| Google BigQuery | Direct write, GCS staging | Google Cloud environments |
| Amazon Redshift | Direct write, S3 staging  | AWS environments          |
| Databricks      | Delta Lake, Unity Catalog | ML workflows              |
| PostgreSQL      | Direct write              | Self-hosted analytics     |

## Snowflake Integration

```python title="snowflake_integration.py" theme={null}
from akhara import Akhara

client = Akhara()

# Configure Snowflake export
snowflake = client.integrations.data_warehouse.configure(
    provider="snowflake",
    name="analytics_warehouse",

    # Connection details
    account="your-account.snowflakecomputing.com",
    warehouse="AKHARA_WH",
    database="ANALYTICS",
    schema="AKHARA_DATA",

    # Authentication
    auth_type="key_pair",  # or "password", "oauth"
    user="AKHARA_SERVICE",
    private_key_path="/path/to/private_key.p8",

    # Export settings
    export_settings={
        "format": "parquet",
        "compression": "snappy",
        "staging": "s3://your-bucket/snowflake-staging/"
    }
)

# Set up scheduled export
client.integrations.data_warehouse.schedule_export(
    integration_id=snowflake.id,

    # What to export
    data_sources=[
        "evaluations",
        "samples",
        "metrics",
        "human_reviews"
    ],

    # Schedule
    schedule="0 2 * * *",  # Daily at 2 AM

    # Incremental export
    mode="incremental",
    watermark_column="updated_at"
)
```

### Snowflake Schema

```sql title="snowflake_schema.sql" theme={null}
-- Akhara evaluation data lands in these tables

-- Evaluations table
CREATE TABLE rubric_data.evaluations (
    evaluation_id VARCHAR PRIMARY KEY,
    project_id VARCHAR,
    name VARCHAR,
    dataset_id VARCHAR,
    model_version VARCHAR,
    status VARCHAR,
    created_at TIMESTAMP_NTZ,
    completed_at TIMESTAMP_NTZ,
    config VARIANT,
    summary VARIANT
);

-- Samples table
CREATE TABLE rubric_data.samples (
    sample_id VARCHAR PRIMARY KEY,
    evaluation_id VARCHAR,
    input VARIANT,
    ai_output VARIANT,
    expected_output VARIANT,
    metadata VARIANT,
    created_at TIMESTAMP_NTZ
);

-- Scores table
CREATE TABLE rubric_data.scores (
    score_id VARCHAR PRIMARY KEY,
    sample_id VARCHAR,
    evaluator_type VARCHAR,
    score FLOAT,
    reasoning TEXT,
    metadata VARIANT,
    created_at TIMESTAMP_NTZ
);
```

## BigQuery Integration

```python title="bigquery_integration.py" theme={null}
from akhara import Akhara

client = Akhara()

# Configure BigQuery export
bigquery = client.integrations.data_warehouse.configure(
    provider="bigquery",
    name="gcp_analytics",

    # GCP settings
    project_id="your-gcp-project",
    dataset_id="rubric_analytics",
    location="US",

    # Authentication
    auth_type="service_account",
    credentials_path="/path/to/service-account.json",

    # Export settings
    export_settings={
        "write_disposition": "WRITE_APPEND",
        "partitioning": {
            "field": "created_at",
            "type": "DAY"
        },
        "clustering": ["project_id", "model_version"]
    }
)

# Export evaluation data to BigQuery
export_result = client.integrations.data_warehouse.export(
    integration_id=bigquery.id,

    evaluation_id="eval_abc123",

    # Tables to populate
    tables={
        "evaluations": "rubric_analytics.evaluations",
        "samples": "rubric_analytics.samples",
        "scores": "rubric_analytics.scores"
    }
)

print(f"Exported {export_result.rows_exported} rows")
```

## Redshift Integration

```python title="redshift_integration.py" theme={null}
from akhara import Akhara

client = Akhara()

# Configure Redshift export
redshift = client.integrations.data_warehouse.configure(
    provider="redshift",
    name="aws_analytics",

    # Cluster details
    host="your-cluster.redshift.amazonaws.com",
    port=5439,
    database="analytics",
    schema="rubric",

    # Authentication
    auth_type="iam",  # or "password"
    iam_role="arn:aws:iam::123456789:role/RedshiftLoadRole",

    # Staging (required for bulk loads)
    staging_bucket="s3://your-bucket/redshift-staging/",

    # Export settings
    export_settings={
        "distribution_style": "KEY",
        "distribution_key": "evaluation_id",
        "sort_keys": ["created_at"]
    }
)
```

## Databricks Integration

```python title="databricks_integration.py" theme={null}
from akhara import Akhara

client = Akhara()

# Configure Databricks export
databricks = client.integrations.data_warehouse.configure(
    provider="databricks",
    name="ml_platform",

    # Workspace details
    workspace_url="https://your-workspace.cloud.databricks.com",

    # Authentication
    auth_type="service_principal",
    client_id="your-client-id",
    client_secret="your-client-secret",

    # Unity Catalog settings
    catalog="ml_analytics",
    schema="rubric",

    # Delta Lake settings
    export_settings={
        "format": "delta",
        "mode": "merge",  # Upsert capability
        "merge_keys": ["sample_id"],
        "partition_by": ["date(created_at)"]
    }
)

# Export with Delta Lake merge
client.integrations.data_warehouse.export(
    integration_id=databricks.id,

    # Export all recent evaluations
    filters={
        "created_after": "2024-01-01"
    },

    # Target tables
    tables={
        "evaluations": "ml_analytics.client.evaluations",
        "samples": "ml_analytics.client.samples",
        "scores": "ml_analytics.akhara.scores"
    }
)
```

## Real-Time Streaming

Stream evaluation data in real-time:

```python title="streaming_export.py" theme={null}
from akhara import Akhara

client = Akhara()

# Configure streaming export
stream = client.integrations.data_warehouse.configure_stream(
    integration_id="snowflake_prod",

    # Events to stream
    events=[
        "evaluation.completed",
        "sample.scored",
        "review.submitted"
    ],

    # Streaming settings
    streaming_config={
        "buffer_size": 100,
        "flush_interval_seconds": 30,
        "format": "json"
    },

    # Target
    target_table="ANALYTICS.AKHARA.EVENTS_STREAM"
)
```

## Best Practices

| Practice                  | Rationale                          |
| ------------------------- | ---------------------------------- |
| Use incremental exports   | Reduce data transfer and costs     |
| Partition by date         | Improve query performance          |
| Cluster by common filters | Optimize for typical queries       |
| Set up monitoring         | Alert on export failures           |
| Use staging buckets       | Required for bulk loads            |
| Schedule off-peak         | Avoid impacting production queries |
