Skip to main content

Connecting to existing warehouse tables

To sync existing, pre-calculated attributes to Signals, use an ExternalBatchAttributeGroup attribute group to define which source table to use, and which fields (columns) to use from the table. Using existing warehouse tables doesn't require any additional modeling.

Configure which table to sync by specifying a BatchSource object for the group.

info

A BatchSource isn't required for BatchAttributeGroup objects, only ExternalBatchAttributeGroup.

Provide source table details

The BatchSource defines how to connect to the table of interest in your warehouse. Here's an example:

from snowplow_signals import BatchSource

data_source = BatchSource(
name="ecommerce_transaction_interactions_source",
database="SNOWPLOW_DEV1",
schema="SIGNALS",
table="SNOWPLOW_ECOMMERCE_TRANSACTION_INTERACTIONS_FEATURES",
timestamp_field="UPDATED_AT",
owner="user@company.com",
)

The table below lists all available arguments for a BatchSource:

ArgumentDescriptionTypeRequired?
nameThe name of the sourcestring
descriptionA description of the sourcestring
databaseThe database where the attributes are storedstring
schemaThe schema for the table of intereststring
tableThe table where the attributes are storedstring
timestamp_fieldPrimary timestamp of the attribute valuestring
ownerThe owner of the source, typically the email of the primary maintainerstring

The sync engine only sends rows with a newer timestamp to the Profiles Store, based on the timestamp_field. For each attribute key, make sure there is only one row per timestamp — otherwise, one value may be discarded arbitrarily.

Define which fields to sync

Instead of attributes, this attribute group class has fields.

Here's an example:

from snowplow_signals import ExternalBatchAttributeGroup, domain_userid, Field

attribute_group = ExternalBatchAttributeGroup(
name="ecommerce_transaction_interactions_attributes",
version=1,
attribute_key=domain_userid,
owner="user@company.com",
batch_source=data_source,
fields=[
Field(
name="TOTAL_TRANSACTIONS",
type="int32",
),
Field(
name="TOTAL_REVENUE",
type="int32",
),
Field(
name="AVG_TRANSACTION_REVENUE",
type="int32",
),
],
)

The table below lists all available arguments for a Field:

ArgumentDescriptionTypeRequired?
nameThe name of the fieldstring
descriptionA description of the fieldstring
typeThe type of the fieldOne of: bytes, string, int32, int64, double, float, bool, unix_timestamp, bytes_list, string_list, int32_list, int64_list, double_list, float_list, bool_list, unix_timestamp_list,

On this page

Want to see a custom demo?

Our technical experts are here to help.