Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

rhosocial-activerecord-snowflake

Python Apache 2.0 License Powered by vistart

rhosocial ActiveRecord Logo

Snowflake Backend for rhosocial-activerecord

Cloud Data Warehouse Support · VARIANT & ARRAY Types · Time Travel Queries

Note: This is a backend implementation for rhosocial-activerecord. It cannot be used standalone.

Why This Backend?

1. Snowflake-Specific Optimizations

Feature This Backend Generic Solutions
VARIANT Type Native semi-structured data JSON serialize/deserialize
Time Travel AT/BEFORE point-in-time queries Manual snapshot management
ARRAY Type Native array operations Comma-separated strings
MERGE Native upsert with conditions Manual check-then-insert

2. True Sync-Async Parity

Same API surface for both sync and async operations:

# Sync
users = User.query().where(User.c.age >= 18).all()

# Async - just add await
users = await User.query().where(User.c.age >= 18).all()

3. Built for Cloud Data Warehouse

  • Warehouse-aware connection configuration
  • Schema and role support for multi-tenant environments
  • Time travel for point-in-time data access
  • VARIANT/ARRAY type adapters for semi-structured data

Quick Start

Installation

pip install rhosocial-activerecord-snowflake

Basic Usage

from rhosocial.activerecord.model import ActiveRecord
from rhosocial.activerecord.backend.impl.snowflake import SnowflakeBackend
from rhosocial.activerecord.backend.impl.snowflake.config import SnowflakeConnectionConfig
from typing import Optional

class User(ActiveRecord):
    __table_name__ = "users"
    id: Optional[int] = None
    name: str
    email: str

# Configure
config = SnowflakeConnectionConfig(
    account="your-account",
    warehouse="COMPUTE_WH",
    database="myapp",
    schema="public",
    username="user",
    password="password",
    role="SYSADMIN"
)
User.configure(config, SnowflakeBackend)

# Use
user = User(name="Alice", email="alice@example.com")
user.save()

Snowflake-Specific Features

VARIANT Type (Semi-Structured Data)

Native Snowflake VARIANT support for JSON-like data:

from rhosocial.activerecord.backend.impl.snowflake import SnowflakeVariantAdapter

# Store and query semi-structured data
settings = {"theme": "dark", "notifications": True}

Time Travel Queries

Access historical data using Snowflake's time travel capabilities:

# Query data as of a specific timestamp
results = User.query().where(User.c.age >= 18).all()

# Time travel with AT/BEFORE clauses (via raw SQL)

MERGE (Conditional Upsert)

Efficient conditional insert-or-update operations:

# Snowflake MERGE support for complex upsert scenarios

Requirements

  • Python: 3.8+ (including 3.14t free-threaded builds; 3.13t is NOT supported due to cffi dependency incompatibility)
  • Core: rhosocial-activerecord>=0.9.0
  • Driver: snowflake-connector-python>=3.0.0

Comparison with Other Backends

Feature Snowflake MySQL PostgreSQL SQLite
VARIANT/JSON ✅ VARIANT ✅ JSON ✅ JSONB ⚠️ JSON1
Arrays ✅ ARRAY ❌ ✅ Native ❌
Time Travel ✅ Native ❌ ❌ ❌
MERGE ✅ Native ❌ ✅ (PG 15+) ❌
RETURNING ❌ ❌ ✅ ✅
Cloud-Native ✅ ❌ ❌ ❌

Testing

⚠️ CRITICAL: Tests MUST run serially. Do NOT use pytest -n auto or parallel execution.

# Run all tests
PYTHONPATH=src pytest tests/

# Run specific feature tests
PYTHONPATH=src pytest tests/rhosocial/activerecord_snowflake_test/feature/backend/

Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

License

Apache License 2.0 — Copyright © 2025 vistart


Built with ❤️ by the rhosocial team

GitHub · Documentation · PyPI

Metadata

Release files for rhosocial-activerecord-snowflake 1.0.0.dev1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rhosocial-activerecord-snowflake 1.0.0.dev1
File Size Uploaded
rhosocial_activerecord_snowflake-1.0.0.dev1.tar.gz 31.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rhosocial-activerecord-snowflake 1.0.0.dev1
File Interpreter ABI Platform
rhosocial_activerecord_snowflake-1.0.0.dev1-py3-none-any.whl Python 3 none any Details

Total release size: 66.5 kB

Release files / rhosocial_activerecord_snowflake-1.0.0.dev1.tar.gz

Download URL rhosocial_activerecord_snowflake-1.0.0.dev1.tar.gz
Size 31.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7a3f4770d1ac9c248aeb5b00ba081c3b75a631be01af5d37fef0a97f2a427edd
BLAKE2b-256 checksum
How to use checksums
91722a36636153b94200050f553826be4472d5e675d2b9d48a6d7f2c1a240f32
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 15, 2026.

Transparency log

Release files / rhosocial_activerecord_snowflake-1.0.0.dev1-py3-none-any.whl

Download URL rhosocial_activerecord_snowflake-1.0.0.dev1-py3-none-any.whl
Size 35.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7b53823ae67669c45bc01533af3a7def0e6f402b18ad955aa96f718fb9b6eeee
BLAKE2b-256 checksum
How to use checksums
5cd1451da9d2a29a49472a377b1174cc53582de36b244acd354f7eea7ee9b597
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 15, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.0.dev1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page