Snowflake

Snowflake

English

Deutsch

 

Snowflake Setup

This guide walks through the one-time Snowflake setup required before connecting the Maileon reporting sync plugin. It is meant to be run once per Snowflake account, by someone with ACCOUNTADMIN or equivalent access.

 

What the plugin syncs

The Maileon reporting sync plugin connects Maileon reporting data to Snowflake so campaign activity can be stored, queried, and analyzed in a central warehouse. It syncs event-level reporting data such as opens, recipients, clicks, bounces, blocks, subscribers, and unsubscribes, including timestamps, contact attributes, mailing and message identifiers, and available client/device details. It also syncs mailing-level summary data, such as mailing metadata and aggregate counts for recipients, opens, clicks, bounces, unsubscriptions, replies, and archived status.

Dataset

Synced data

Dataset

Synced data

opens

Timestamp; contact fields; mailingId, transactionId, contactHash, messageId, format, deviceType; client fields.

recipients

Timestamp; contact fields; mailingId, transactionId, messageId.

clicks

Timestamp; contact fields; mailingId, linkId, linkType, linkUrl, linkTags, transactionId, contactHash, messageId, format, deviceType; client fields.

bounces

Timestamp; contact fields; mailingId, type, statusCode, source, messageId.

blocks

Timestamp; contact fields; oldStatus, newStatus, reason.

subscribers

Timestamp; contact fields; mailingId, IP address. The IP is pulled from raw XML because the SDK model does not expose it.

unsubscribes

Timestamp; contact fields; mailingId, transactionId, messageId, source.

mailings

mailingId, name, type, state, scheduleTime; recipients, opens, opensUnique, clicks, clicksUnique, bounces, unsubscriptions, replies, archived. This dataset is built through a discovery loop over MailingsService rather than paginate().

Reusable field group

Fields

Reusable field group

Fields

Contact fields

contactId, email, externalId, anonymous, permissionCode, permissionType, permissionStatus, contactCreated, contactUpdated.

Client fields

os, osGroup, browser, browserType, browserGroup, userAgent, renderingEngine.

Overview

The plugin authenticates to Snowflake using key-pair JWT authentication. There is no password/basic-auth option, since Snowflake's SQL API does not support one. Setup has three parts:

  1. Generate an RSA key pair.

  2. Run the SQL script below to create a role, a user tied to your public key, and the minimum privileges the plugin needs.

  3. Enter the resulting values into the plugin's config screen.

Step 1: Generate an RSA key pair

Run these commands locally (requires OpenSSL, available by default on macOS/Linux):

openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -out rsa_key.p8 -nocrypt openssl rsa -in rsa_key.p8 -pubout -out rsa_key.pub

This produces two files:

File

Contents

What to do with it

File

Contents

What to do with it

rsa_key.p8

Private key

Paste into the plugin's private_key config field. Never paste this into Snowflake.

rsa_key.pub

Public key

Paste into the SQL script below (RSA_PUBLIC_KEY), base64 body only — remove the -----BEGIN/END PUBLIC KEY----- lines and any line breaks.

Step 2: Run the setup script in Snowflake

Run this as ACCOUNTADMIN or a role with equivalent privileges, replacing PASTE_YOUR_PUBLIC_KEY_HERE with your generated public key:

-- ========================= -- ROLE -- ========================= CREATE ROLE IF NOT EXISTS REPORTER; -- ========================= -- USER (key-pair auth only - Snowflake's SQL API has no password/basic-auth option) -- ========================= CREATE USER IF NOT EXISTS SAAS_SYNC_USER RSA_PUBLIC_KEY = 'PASTE_YOUR_PUBLIC_KEY_HERE' DEFAULT_ROLE = REPORTER DEFAULT_WAREHOUSE = COMPUTE_WH MUST_CHANGE_PASSWORD = FALSE; -- Assign role to user GRANT ROLE REPORTER TO USER SAAS_SYNC_USER; -- ========================= -- DATABASE (required) -- ========================= -- The plugin creates its own database on first sync (CREATE DATABASE IF NOT -- EXISTS) - you don't need to pre-create it here. Whoever creates a database in -- Snowflake becomes its owner, and ownership cascades to every schema/table the -- role creates inside it, so no further grants are needed for a fresh database. -- This one grant is what lets that happen: GRANT CREATE DATABASE ON ACCOUNT TO ROLE REPORTER; -- ========================= -- WAREHOUSE ACCESS (required for queries) -- ========================= -- Assumes COMPUTE_WH already exists (most accounts have one by default). -- If not: CREATE WAREHOUSE COMPUTE_WH WAREHOUSE_SIZE = 'XSMALL' AUTO_SUSPEND = 60 AUTO_RESUME = TRUE; GRANT USAGE ON WAREHOUSE COMPUTE_WH TO ROLE REPORTER; -- ========================= -- OPTIONAL: only needed if you want the plugin to write into a database you -- already created yourself, instead of letting it create its own fresh one. -- REPORTER only owns databases it creates itself - a pre-existing database's -- actual owner/admin needs to run this once for whichever database you pick: -- ========================= -- GRANT CREATE SCHEMA ON DATABASE <your_existing_database> TO ROLE REPORTER;

Why these specific grants

  • CREATE DATABASE ON ACCOUNT — required even if the target database already exists. Snowflake checks this privilege before checking whether the database exists, so the plugin's CREATE DATABASE IF NOT EXISTS call needs it on every run, not just the first.

  • No explicit USAGE/CREATE SCHEMA/table grants — unnecessary for the default path. REPORTER becomes the owner of any database, schema, or table it creates, and ownership already includes every privilege on that object. Those grants only matter if you point the plugin at a database it does not own (see the optional block above).

  • No CREATE WAREHOUSE — the plugin never creates a warehouse; it just needs to run queries on an existing one.

Step 3: Plugin configuration

Enter these values in the plugin's config screen:

Field

Value

Required

Field

Value

Required

account_identifier

Your Snowflake account identifier, org-account format (e.g. MYORG-MYACCOUNT)

Yes

username

SAAS_SYNC_USER

Yes

private_key

Contents of rsa_key.p8

Yes

maileon_api_key

Your Maileon API key

Yes

role

REPORTER

No — defaults to REPORTER

warehouse

COMPUTE_WH

No — defaults to COMPUTE_WH

database

Any name you want

No — defaults to MAILEON

schema

Any name you want

No — defaults to REPORTS

Use the legacy dotted account-locator format for account_identifier at your own risk. The plugin does not normalize periods in that format, and it can produce an invalid token. Stick to the org-account format shown above.

Notes

  • Rotating the key pair later: generate a new pair, run ALTER USER SAAS_SYNC_USER SET RSA_PUBLIC_KEY = '<new public key>', then update the private_key field in the plugin config to match.

  • If you ever want to revoke access entirely: DROP USER SAAS_SYNC_USER; or unset the key with ALTER USER SAAS_SYNC_USER UNSET RSA_PUBLIC_KEY; to disable access without deleting the user, role, or data.

 

 

 

 

 

 

Snowflake-Einrichtung

Diese Anleitung beschreibt die einmalige Snowflake-Einrichtung, die vor dem Verbinden des Maileon-Reporting-Sync-Plugins erforderlich ist. Sie ist dafür gedacht, einmal pro Snowflake-Konto von einer Person mit ACCOUNTADMIN- oder gleichwertigem Zugriff ausgeführt zu werden.

Was das Plugin synchronisiert

Das Maileon-Reporting-Sync-Plugin verbindet Maileon-Reporting-Daten mit Snowflake, damit Kampagnenaktivitäten zentral gespeichert, abgefragt und analysiert werden können. Es synchronisiert Reporting-Daten auf Ereignisebene wie Öffnungen, Empfänger, Klicks, Bounces, Sperren, Abonnenten und Abmeldungen, einschließlich Zeitstempeln, Kontaktattributen, Mailing- und Nachrichtenkennungen sowie verfügbaren Client-/Gerätedetails. Außerdem synchronisiert es Zusammenfassungsdaten auf Mailing-Ebene, z. B. Mailing-Metadaten und aggregierte Zählwerte für Empfänger, Öffnungen, Klicks, Bounces, Abmeldungen, Antworten und Archivierungsstatus.

Datensatz

Synchronisierte Daten

Datensatz

Synchronisierte Daten

opens

Zeitstempel; Kontaktfelder; mailingId, transactionId, contactHash, messageId, format, deviceType; Client-Felder.

recipients

Zeitstempel; Kontaktfelder; mailingId, transactionId, messageId.

clicks

Zeitstempel; Kontaktfelder; mailingId, linkId, linkType, linkUrl, linkTags, transactionId, contactHash, messageId, format, deviceType; Client-Felder.

bounces

Zeitstempel; Kontaktfelder; mailingId, type, statusCode, source, messageId.

blocks

Zeitstempel; Kontaktfelder; oldStatus, newStatus, reason.

subscribers

Zeitstempel; Kontaktfelder; mailingId, IP-Adresse. Die IP wird aus dem Roh-XML gelesen, weil das SDK-Modell sie nicht bereitstellt.

unsubscribes

Zeitstempel; Kontaktfelder; mailingId, transactionId, messageId, source.

mailings

mailingId, name, type, state, scheduleTime; recipients, opens, opensUnique, clicks, clicksUnique, bounces, unsubscriptions, replies, archived. Dieser Datensatz wird über eine Discovery-Schleife über MailingsService aufgebaut, nicht über paginate().

Wiederverwendbare Feldgruppe

Felder

Wiederverwendbare Feldgruppe

Felder

Kontaktfelder

contactId, email, externalId, anonymous, permissionCode, permissionType, permissionStatus, contactCreated, contactUpdated.

Client-Felder

os, osGroup, browser, browserType, browserGroup, userAgent, renderingEngine.

Überblick

Das Plugin authentifiziert sich bei Snowflake über Key-Pair-JWT-Authentifizierung. Es gibt keine Passwort-/Basic-Auth-Option, da Snowflakes SQL API diese nicht unterstützt. Die Einrichtung besteht aus drei Teilen:

  1. Ein RSA-Schlüsselpaar generieren.

  2. Das untenstehende SQL-Skript ausführen, um eine Rolle, einen mit Ihrem öffentlichen Schlüssel verknüpften Benutzer und die minimal erforderlichen Berechtigungen für das Plugin zu erstellen.

  3. Die resultierenden Werte in der Konfigurationsmaske des Plugins eintragen.

Schritt 1: RSA-Schlüsselpaar generieren

Führen Sie diese Befehle lokal aus (erfordert OpenSSL, auf macOS/Linux standardmäßig verfügbar):

openssl genrsa 2048 | openssl pkcs8 -topk8 -inform PEM -out rsa_key.p8 -nocrypt openssl rsa -in rsa_key.p8 -pubout -out rsa_key.pub

Dadurch entstehen zwei Dateien:

Datei

Inhalt

Was damit zu tun ist

Datei

Inhalt

Was damit zu tun ist

rsa_key.p8

Privater Schlüssel

In das Konfigurationsfeld private_key des Plugins einfügen. Niemals in Snowflake einfügen.

rsa_key.pub

Öffentlicher Schlüssel

In das untenstehende SQL-Skript einfügen (RSA_PUBLIC_KEY), nur den Base64-Inhalt — entfernen Sie die Zeilen -----BEGIN/END PUBLIC KEY----- und alle Zeilenumbrüche.

Schritt 2: Einrichtungsskript in Snowflake ausführen

Führen Sie dies als ACCOUNTADMIN oder mit einer Rolle mit gleichwertigen Berechtigungen aus und ersetzen Sie PASTE_YOUR_PUBLIC_KEY_HERE durch Ihren generierten öffentlichen Schlüssel:

-- ========================= -- ROLLE -- ========================= CREATE ROLE IF NOT EXISTS REPORTER; -- ========================= -- BENUTZER (nur Key-Pair-Authentifizierung - Snowflakes SQL API bietet keine Passwort-/Basic-Auth-Option) -- ========================= CREATE USER IF NOT EXISTS SAAS_SYNC_USER RSA_PUBLIC_KEY = 'PASTE_YOUR_PUBLIC_KEY_HERE' DEFAULT_ROLE = REPORTER DEFAULT_WAREHOUSE = COMPUTE_WH MUST_CHANGE_PASSWORD = FALSE; -- Rolle dem Benutzer zuweisen GRANT ROLE REPORTER TO USER SAAS_SYNC_USER; -- ========================= -- DATENBANK (erforderlich) -- ========================= -- Das Plugin erstellt beim ersten Sync seine eigene Datenbank (CREATE DATABASE IF NOT -- EXISTS) - Sie müssen sie hier nicht vorab erstellen. Wer in Snowflake eine Datenbank -- erstellt, wird deren Eigentümer, und diese Eigentümerschaft wird auf jedes Schema/jede -- Tabelle übertragen, die die Rolle darin erstellt. Daher sind für eine neue Datenbank -- keine weiteren Berechtigungen nötig. Diese eine Berechtigung ermöglicht genau das: GRANT CREATE DATABASE ON ACCOUNT TO ROLE REPORTER; -- ========================= -- WAREHOUSE-ZUGRIFF (für Abfragen erforderlich) -- ========================= -- Setzt voraus, dass COMPUTE_WH bereits existiert (die meisten Konten haben eines standardmäßig). -- Falls nicht: CREATE WAREHOUSE COMPUTE_WH WAREHOUSE_SIZE = 'XSMALL' AUTO_SUSPEND = 60 AUTO_RESUME = TRUE; GRANT USAGE ON WAREHOUSE COMPUTE_WH TO ROLE REPORTER; -- ========================= -- OPTIONAL: nur erforderlich, wenn das Plugin in eine Datenbank schreiben soll, -- die Sie bereits selbst erstellt haben, statt eine eigene neue Datenbank erstellen zu lassen. -- REPORTER besitzt nur Datenbanken, die es selbst erstellt - bei einer bereits vorhandenen -- Datenbank muss deren tatsächlicher Eigentümer/Admin dies einmal für die gewählte Datenbank ausführen: -- ========================= -- GRANT CREATE SCHEMA ON DATABASE <your_existing_database> TO ROLE REPORTER;

Warum genau diese Berechtigungen

  • CREATE DATABASE ON ACCOUNT — erforderlich, selbst wenn die Zieldatenbank bereits existiert. Snowflake prüft diese Berechtigung, bevor geprüft wird, ob die Datenbank existiert. Daher benötigt der CREATE DATABASE IF NOT EXISTS-Aufruf des Plugins sie bei jeder Ausführung, nicht nur beim ersten Mal.

  • Keine expliziten USAGE/CREATE SCHEMA/Tabellen-Berechtigungen — für den Standardpfad nicht notwendig. REPORTER wird Eigentümer jeder Datenbank, jedes Schemas oder jeder Tabelle, die es erstellt, und Eigentümerschaft enthält bereits alle Berechtigungen für dieses Objekt. Diese Berechtigungen sind nur relevant, wenn Sie das Plugin auf eine Datenbank zeigen lassen, die es nicht besitzt (siehe optionalen Block oben).

  • Kein CREATE WAREHOUSE — das Plugin erstellt niemals ein Warehouse; es muss nur Abfragen auf einem bestehenden Warehouse ausführen.

Schritt 3: Plugin-Konfiguration

Geben Sie diese Werte in der Konfigurationsmaske des Plugins ein:

Feld

Wert

Erforderlich

Feld

Wert

Erforderlich

account_identifier

Ihr Snowflake-Konto-Identifier im Org-Account-Format (z. B. MYORG-MYACCOUNT)

Ja

username

SAAS_SYNC_USER

Ja

private_key

Inhalt von rsa_key.p8

Ja

maileon_api_key

Ihr Maileon-API-Schlüssel

Ja

role

REPORTER

Nein — Standardwert ist REPORTER

warehouse

COMPUTE_WH

Nein — Standardwert ist COMPUTE_WH

database

Ein beliebiger Name Ihrer Wahl

Nein — Standardwert ist MAILEON

schema

Ein beliebiger Name Ihrer Wahl

Nein — Standardwert ist REPORTS

Verwenden Sie das ältere gepunktete Account-Locator-Format für account_identifier auf eigenes Risiko. Das Plugin normalisiert Punkte in diesem Format nicht, und dadurch kann ein ungültiges Token entstehen. Bleiben Sie beim oben gezeigten Org-Account-Format.

Hinweise

  • Schlüsselpaar später rotieren: Generieren Sie ein neues Paar, führen Sie ALTER USER SAAS_SYNC_USER SET RSA_PUBLIC_KEY = '<new public key>' aus und aktualisieren Sie anschließend das Feld private_key in der Plugin-Konfiguration passend dazu.

  • Wenn Sie den Zugriff jemals vollständig entziehen möchten: DROP USER SAAS_SYNC_USER; oder entfernen Sie den Schlüssel mit ALTER USER SAAS_SYNC_USER UNSET RSA_PUBLIC_KEY;, um den Zugriff zu deaktivieren, ohne Benutzer, Rolle oder Daten zu löschen.