Event Mapping
The component maps Edgee events to Snowflake records using a hybrid schema approach that combines scalar columns for frequently queried fields with OBJECT types for semi-structured data:Edgee Event | Snowflake Record | Description |
---|---|---|
Page | Scalar columns + OBJECT context/data | Page event with data:Page.* in data OBJECT |
Track | Scalar columns + OBJECT context/data | Track event with data:Track.* in data OBJECT |
User | Scalar columns + OBJECT context/data | User event with data:User.* in data OBJECT |
uuid
: Event UUID (VARCHAR)event_type
: “Page”, “Track”, or “User” (VARCHAR)timestamp
: Event timestamp (TIMESTAMP_NTZ)consent
: Consent status (VARCHAR)context
: User, client, session, campaign data (OBJECT)data
: Event-specific payload (OBJECT)
Getting Started
To integrate Snowflake into your Edgee project:1
Open the Edgee console
Navigate to your project’s Components section in the Edgee console.
2
Add the Snowflake component
Select “Add a component” and choose
edgee/snowflake
from the list of available components.3
Configure the component
Enter your Snowflake configuration:
- Account Identifier: Your Snowflake account identifier (e.g.,
xy12345.us-east-1
) - Access Token: Authentication token (PAT, OAuth, JWT - see Authentication section below)
- Warehouse: Compute warehouse name (e.g.,
COMPUTE_WH
) - Database: Target database name (e.g.,
ANALYTICS
) - Table: Target table name (e.g.,
edgee_events
) - Schema (optional): Schema name (defaults to
PUBLIC
) - Role (optional): Snowflake role to use
- Auth Type (optional): Explicitly specify authentication method (defaults to
Auto
)
4
Create the Snowflake table
Create a new table in Snowflake with the correct schema (see next section).
5
Verify the setup
Once the component has been configured and the table is created, you are ready to send new records to Snowflake.
Creating the Snowflake Table
Before ingesting events, you’ll need to create a new table with the following schema:Schema Design
This hybrid approach combines scalar columns with semi-structured data types for optimal performance: Scalar Columns (uuid
, event_type
, timestamp
, consent
):
- Fast Filtering: Direct indexing and filtering on common query fields
- Efficient Sorting: Timestamp-based ordering without JSON parsing
- Better Compression: Native data type storage
- Timestamp Storage: TIMESTAMP_NTZ (No Time Zone) preserves exact “wall clock” time
context
, data
):
- Structured Storage: Optimized for key-value pairs with consistent schemas
- JSON Querying: Full support for JSON path expressions like
context:client.ip
Querying Event Data
Once events are stored, you can query them using Snowflake’s JSON functions:Authentication
The component supports all Snowflake authentication methods through the Access Token field in the Edgee console. You can optionally specify the authentication method using the Auth Type field for explicit control.Auto Detection (Default)
The simplest setup where Snowflake automatically detects the token type. Simply paste your token in the Access Token field and leave Auth Type asAuto
(or empty). This works with any authentication method without additional configuration.
Programmatic Access Token (PAT)
Recommended for production environments. Generate a PAT token and paste it into the Access Token field. How to generate: Follow Snowflake’s PAT documentation Example token format:sfp_5FZvZ4M1...
OAuth Token
For integration with existing OAuth flows. Generate an OAuth access token and paste it into the Access Token field. How to generate: Use the OAuth 2.0 flow with Snowflake authorization server Example token format:ETMsjXXXXXXX...
Key-Pair Authentication (JWT)
Enhanced security with private key authentication. Generate a JWT token using your private key and paste it into the Access Token field. How to generate: Create JWT using your private key following Snowflake’s key-pair documentation Example token format:eyJhbGciOiJSUzI1NiJ5...
Required Permissions
Ensure your authentication token has permissions to:- Use the specified warehouse
- Access the target database and schema
- Insert data into the target table
The component uses Snowflake’s SQL API (
/api/v2/statements/
) for data ingestion with parameterized INSERT INTO ... SELECT ... FROM VALUES
statements and PARSE_JSON()
for context and data fields.Component Name
When configuring the component in your Edgee Data Layer or within SDK calls, useedgee/snowflake
as the component name: