Skip to content

Snowflake

EdgeKit can load your events into a table in your own Snowflake account, every 15 minutes, and your EdgeKit records beside them. You create two schemas, a role that owns them and a service user, and give EdgeKit one connection URI. See Warehouse for the load itself.

  1. A database and two schemas. EdgeKit loads your events into EDGEKIT.EVENTS unless you name another <schema>.<table>. Always name a schema: EdgeKit stages each load in the table’s own schema. The second schema, EDGEKIT_V1 in the same database, holds the export schema.
  2. A role that owns both schemas, with usage on the database and on a warehouse. Ownership, not a list of grants: EdgeKit creates the tables, adds their columns and, on each run, creates and drops staging tables there. The role needs no right to create schemas.
  3. A service user with key-pair authentication, whose default role is that role. Use an unencrypted PKCS#8 key.
CREATE DATABASE ANALYTICS;
CREATE SCHEMA ANALYTICS.EDGEKIT;
CREATE SCHEMA ANALYTICS.EDGEKIT_V1;
CREATE ROLE EDGEKIT_LOADER;
GRANT USAGE ON WAREHOUSE LOAD_WH TO ROLE EDGEKIT_LOADER;
GRANT USAGE ON DATABASE ANALYTICS TO ROLE EDGEKIT_LOADER;
GRANT OWNERSHIP ON SCHEMA ANALYTICS.EDGEKIT TO ROLE EDGEKIT_LOADER;
GRANT OWNERSHIP ON SCHEMA ANALYTICS.EDGEKIT_V1 TO ROLE EDGEKIT_LOADER;
CREATE USER EDGEKIT_LOADER_SVC
TYPE = SERVICE
DEFAULT_ROLE = EDGEKIT_LOADER
DEFAULT_WAREHOUSE = LOAD_WH
DEFAULT_NAMESPACE = ANALYTICS.EDGEKIT
RSA_PUBLIC_KEY = '<public key, body lines only>';
GRANT ROLE EDGEKIT_LOADER TO USER EDGEKIT_LOADER_SVC;

Make the key pair on your own machine:

Terminal window
openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -nocrypt -out edgekit_loader.p8
openssl rsa -in edgekit_loader.p8 -pubout

The second command prints the public key. Put its body lines, without the header and footer, in RSA_PUBLIC_KEY.

Loads replace EDGEKIT_V1 tables whole, most of them every run and all of them nightly, so a privilege granted on one table lasts a day at most. Give your own roles read access with Snowflake’s future grants on the schema instead:

GRANT USAGE ON SCHEMA ANALYTICS.EDGEKIT_V1 TO ROLE ANALYST;
GRANT SELECT ON FUTURE TABLES IN SCHEMA ANALYTICS.EDGEKIT_V1 TO ROLE ANALYST;
GRANT SELECT ON ALL TABLES IN SCHEMA ANALYTICS.EDGEKIT_V1 TO ROLE ANALYST;

One URI, with the whole private key URL-encoded:

snowflake://EDGEKIT_LOADER_SVC@<account identifier>/ANALYTICS?warehouse=LOAD_WH&role=EDGEKIT_LOADER&private_key=<URL-encoded PKCS#8 key>

Give EdgeKit the table name too if it is not EDGEKIT.EVENTS. The URI holds your private key. EdgeKit stores it for your organization, and there is no console screen for it. A URI that does not start with snowflake:// is refused before any load runs.

EdgeKit loads from the moment it has the URI. To stop, ask EdgeKit to remove it: loads stop and the table stays.

  • Every 15 minutes, EdgeKit reads the archive files written between 30 and 2 minutes before the run. Runs overlap, so each file is read at least once and one missed run loses nothing. A run with no new file loads no events, but still loads the export schema, so every run wakes your warehouse.
  • Valid events only, from all your sites, one row per event, into one table. Each row’s site is in its contexts_cloud_edgekit_tenant_1 column. Bad rows are never loaded.
  • Every event column, plus one VARIANT column per schema major for its self-describing events, and one for its entities. A column is added the first time a load carries it; earlier rows hold null in it. See Warehouse for the columns. The table also gets one column with the time each row’s archive file was written, which EdgeKit uses to bound each merge.
  • No clustering. Once the table grows large, cluster it yourself if your queries need it.
  • Then the export schema: each run merges what changed into the EDGEKIT_V1 tables that grow with your users, and replaces the rest whole. Once a night, every table is replaced whole. See Export schema.
  • One warehouse for your organization.
  • Streaming ingest is experimental. Loads run in batches, every 15 minutes. Streaming events into Snowflake as they arrive is at an experimental stage: let us know if you need it.
  • Loads start when you connect. EdgeKit then backfills the events archived before then, one day at a time, from the start of your archive or a date you choose. A gap after two or more missed runs is filled the same way.
  • The copy is yours. EdgeKit never deletes from your events table, and erasing a user in EdgeKit does not reach it. Retention and erasure there are yours. The rows carry the personal data your events carry. An erasure reaches the EDGEKIT_V1 tables: the user’s email address is nulled on the next load, and their profiles and own trait values leave within a day.

edgekit.ai