Skip to main content

No project description provided

Project description

Snowplow Signals SDK

The Snowplow Signals SDK is a Python SDK that enables you to interact with the Snowplow Signals Profile API. It provides a simple interface to define, deploy, and retrieve user attributes for personalization.

Installation

pip install snowplow-signals

Quickstart

from snowplow_signals import Signals, Attribute, Event, View, domain_sessionid

# Initialize the SDK
signals = Signals(
    api_url="API_URL",
    api_key="API_KEY",
    api_key_id="API_KEY_ID",
    org_id="ORG_ID",
)

# Define an attribute
page_view_count = Attribute(
    name="page_view_count",
    type="int32",
    events=[
        Event(
            vendor="com.snowplowanalytics.snowplow",
            name="page_view",
            version="1-0-0",
        )
    ],
    aggregation="counter"
)

# Create and deploy a view
view = StreamView(
    name="my_view",
    version=1,
    entity=domain_sessionid,
    attributes=[page_view_count],
)
signals.apply([view])

# Retrieve attributes
response = signals.get_view_attributes(
    name="my_view",
    version=1,
    entity="domain_sessionid",
    attributes=["page_view_count"],
    identifier="abc-123",
)

Key Features

  • Define attributes based on Snowplow events
  • Create views to group related attributes
  • Deploy views to the Profile API
  • Retrieve real-time user attributes

DBT Project Generation

The SDK includes functionality to automatically generate DBT projects for Snowplow data. This makes it easy to set up and maintain DBT projects that work with Snowplow data.

Using the SDK

from snowplow_signals import Signals

# Initialize the signals client
signals = Signals(api_url="https://your-api-url.com")

# Initialize a DBT project
signals.batch_autogen.init_project(
    repo_path="path/to/your/repo",
    target_type="snowflake" # or bigquery
    project_name="your_project_name"  # Optional
)

# Generate DBT models
signals.batch_autogen.generate_models(
    repo_path="path/to/your/repo",
    target_type="snowflake" # or bigquery
    project_name="your_project_name",  # Optional
    update=True  # Whether to update existing files
)

Using the Command Line

The SDK also includes a command-line interface for DBT project generation. To make your workflow smoother, you can set up your API credentials as environment variables. This way, you won't need to type them in every command:

export SNOWPLOW_API_URL="YOUR_API_URL"
export SNOWPLOW_API_KEY="YOUR_API_KEY"
export SNOWPLOW_API_KEY_ID="YOUR_API_KEY_ID"
export SNOWPLOW_ORG_ID="YOUR_ORG_ID"
export SNOWPLOW_REPO_PATH="./my_snowplow_repo"
# Initialize a DBT project
snowplow-batch-autogen init --repo-path=path/to/your/repo --target-type=snowflake [--project-name=your_project_name]

# Generate DBT models
snowplow-batch-autogen generate --repo-path=path/to/your/repo --target-type=bigquery [--project-name=your_project_name] [--update]

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

snowplow_signals-0.1.5.tar.gz (44.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

snowplow_signals-0.1.5-py3-none-any.whl (68.7 kB view details)

Uploaded Python 3

File details

Details for the file snowplow_signals-0.1.5.tar.gz.

File metadata

  • Download URL: snowplow_signals-0.1.5.tar.gz
  • Upload date:
  • Size: 44.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.11.13 Linux/6.11.0-1018-azure

File hashes

Hashes for snowplow_signals-0.1.5.tar.gz
Algorithm Hash digest
SHA256 8df994b9fc6c0745af8ba7cc182fa18505e4f18f19011b69d86dfb4353b9c363
MD5 0736f10808776648f766000b04218757
BLAKE2b-256 cb5c70209158310d255414caee4049d11ce966df12f8e6d41303ba93d7c6b0d5

See more details on using hashes here.

File details

Details for the file snowplow_signals-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: snowplow_signals-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 68.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.4 CPython/3.11.13 Linux/6.11.0-1018-azure

File hashes

Hashes for snowplow_signals-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 8d39e43c8184c08ea341e30100305842ebfb8737b76b631437723e4dafe49891
MD5 68e660e72d8d7aa1d396ec76f19e3276
BLAKE2b-256 1d9caa46cd35ae6e4dadf1168f6da35e8fcf6f270502e187bc33da5182cc12b2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page