IntegrationsDatabasesGoogle Cloud SQL

Google Cloud SQL

Datafly Signal writes first-party events directly to a Google Cloud SQL instance over the native database protocol. Signal connects to Cloud SQL exactly as any application would — via public IP with authorised networks, or via private IP within a VPC.

The engine setting selects the writer:

  • postgres: Cloud SQL for PostgreSQL, over the PostgreSQL wire protocol.
  • mysql: Cloud SQL for MySQL, over the MySQL wire protocol.
  • sqlserver: Cloud SQL for SQL Server, over the same TDS protocol as Azure SQL.

Why route Google Cloud SQL through Datafly Signal

  • The data lands in infrastructure you own. Signal writes to your Google Cloud SQL directly from your own deployment. Datafly operates no intermediary and never holds a copy of your event data.
  • Personal data is hashed on the way in. Email, phone (shaped to E.164 first), first, last and full name and postcode are normalised (trimmed and lower-cased) and hashed with SHA-256 inside your own deployment, so the table holds email_sha256, phone_sha256 and the other digests rather than the raw values. Storing a raw value is a deliberate edit to the installed blueprint.
  • Only what the blueprint maps is stored. The properties Signal writes are exactly the fields the blueprint maps. Identify traits and client properties the blueprint does not map are never written, so a stray email in an event property cannot land in Cloud SQL in plain text.
  • Presets for Retail, Insurance, Travel, Media & Streaming, B2B / SaaS, Automotive and General. Each vertical preset names one field per property in the matching event spec, with canonical names (transaction_id, value, items), legacy aliases (order_id, revenue, products) read automatically, numbers typed as numbers and currency codes upper-cased.
  • Client IP and user agent are recorded as event context. Both come from the original visitor request rather than from your server, so geography and device analysis done in the warehouse reflects the actual visitor.
  • One consent decision governs every destination. Google Cloud SQL is gated by the same consent state as the rest of your stack, so a withdrawal applies everywhere at once.

Prerequisites

Before configuring this integration you need a Cloud SQL instance, a target schema/table, a database user, and network connectivity from Signal to the instance.

Create a Cloud SQL Instance

  1. Go to the Cloud SQL console.
  2. Click Create Instance and select a database engine (PostgreSQL, MySQL or SQL Server).
  3. Enter an Instance ID (e.g. datafly-events) and set the root password.
  4. Select a Region and Zone.
  5. Pick a Machine type based on workload.
  6. Under Connections, configure:
    • Public IP — enable if Signal connects from outside GCP. Add authorised networks (Signal’s IP addresses).
    • Private IP — enable if Signal runs within the same VPC.
  7. Click Create Instance.

Note the Public IP address (or private IP, depending on your setup) and Port (5432 PostgreSQL, 3306 MySQL, 1433 SQL Server).

Configure Authorised Networks

If using public IP:

  1. Open the instance, go to Connections > Networking > Authorised networks.
  2. Click Add a network and enter your Signal deployment’s IP addresses.
  3. Click Save.
⚠️

Never authorise 0.0.0.0/0 in production. Restrict access to your Signal infrastructure’s IP addresses or use VPC peering / private IP.

Create a Database, Schema, and Table

Connect to the instance and create the target objects. Use the table definition from the matching engine guide:

Create a Database User for Signal

Example for PostgreSQL:

CREATE USER datafly_signal WITH PASSWORD 'your_secure_password';
GRANT USAGE ON SCHEMA datafly TO datafly_signal;
GRANT INSERT ON TABLE datafly.events TO datafly_signal;
GRANT SELECT (message_id) ON TABLE datafly.events TO datafly_signal;

PostgreSQL needs SELECT on message_id for the ON CONFLICT (message_id) insert and SQL Server needs it for the existence check before the insert; MySQL needs INSERT only. See the grants on the PostgreSQL, MySQL and Azure SQL pages.

Configuration

Install the integration once and pick the engine; all three engines take the same fields and write the same columns.

FieldTypeRequiredDescription
engineselectYespostgres (default), mysql or sqlserver. Selects the writer.
hoststringYesThe Cloud SQL instance (or 127.0.0.1 behind the Cloud SQL Auth Proxy) hostname or IP address (for SQL Server, server is also accepted).
portstringNoDatabase port. Blank uses the chosen engine’s default (5432 PostgreSQL, 3306 MySQL, 1433 SQL Server); another engine’s default port is treated as blank, so an integration switched to MySQL or SQL Server does not keep 5432. Set it only for a non-default port (or the local port of the Cloud SQL Auth Proxy).
databasestringYesThe target database name.
schema_namestringNoPostgreSQL (default public) and SQL Server (default dbo); ignored for MySQL.
table_namestringYesThe target table name.
usernamestringYesDatabase username with INSERT on the table.
passwordsecretYesDatabase password.
ssl_modestringNoPostgreSQL only: libpq sslmode (disable, require, verify-ca, verify-full). Defaults to require.
tls_modestringNoMySQL only: true verifies the server certificate and host name, against ca_certificate when set (otherwise the system roots, which do not include the managed service’s CA); verify-ca verifies the chain against ca_certificate but not the host name; skip-verify and preferred encrypt without verifying; false or empty connects without TLS.
encryptstringNoSQL Server only: true (default), false or disable. With true and false the server certificate is verified (false still encrypts the login), against ca_certificate when set, otherwise the system roots. disable connects without encryption and cannot be combined with ca_certificate.
ca_certificatetextareaNoMySQL and SQL Server: the PEM bundle of the certificate authority that signed the server’s certificate (the instance’s server CA), so the connection is encrypted and verified. Not used by PostgreSQL.
connection_namestringNoThe instance connection name (project:region:instance), for your reference and the Auth Proxy; Signal connects by host and port.

Signal Setup

Quick Setup

  1. Navigate to Integrations in the sidebar.
  2. Open the Integration Library tab.
  3. Find Google Cloud SQL or filter by Database.
  4. Click Install, select the variant matching your engine (postgres or mysql), and fill in the required fields.
  5. Click Install Integration to create the integration with a ready-to-use default blueprint.

API Setup (PostgreSQL example)

curl -X POST http://localhost:8084/v1/admin/integration-catalog/google_cloud_sql/install \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Google Cloud SQL (PostgreSQL)",
    "variant": "postgres",
    "config": {
      "engine": "postgres",
      "host": "34.123.45.67",
      "port": "5432",
      "database": "datafly_events",
      "schema_name": "datafly",
      "table_name": "events",
      "username": "datafly_signal",
      "password": "your_secure_password",
      "ssl_mode": "require"
    },
    "delivery_mode": "server_side"
  }'

Schema

Signal writes the same sixteen columns on every engine (PostgreSQL, MySQL and SQL Server); the engine field selects the writer. Create the table with the DDL on the matching engine page and use its query examples:

ColumnContents
message_idUnique per delivered event; the idempotency key (a redelivery is not inserted twice).
event_typetrack, page, identify, and so on.
event_nameSignal event name (snake_case), for example purchase.
anonymous_idFirst-party visitor identifier.
user_idLogged-in user identifier; NULL when absent.
ip_address, user_agentClient IP and user agent from the visitor’s request.
page_url, page_path, page_referrerPage context.
org_id, pipeline_idSignal identifiers.
event_timestampClient event time (UTC).
received_atTime Signal received the event (UTC).
properties_jsonThe fields the blueprint mapped, as JSON (below).
context_jsonThe event context as JSON: page, device, campaign, consent, IP and user agent.

What the properties hold

The blueprint decides what properties_json contains, and only mapped fields are written (identify traits and unmapped client properties never are):

  • The event’s own fields from the preset sit at the top level, for example transaction_id, value, currency, items, insurance_type or policy_term_months.
  • The preset’s global block sits under @root: copies of the envelope (event_name, event_type, user_id, anonymous_id, event_id, message_id, event_timestamp, page_url, page_referrer, ip_address, user_agent, locale, timezone, source_id), utm_source, utm_medium, utm_campaign, the consent flags consent_analytics and consent_marketing, and the hashed identity email_sha256, phone_sha256, first_name_sha256, last_name_sha256, name_sha256.
  • identify adds name_sha256 and postal_code_sha256 at the top level.
  • An event the preset does not list stores its envelope and the @root block only.

For example, on PostgreSQL:

SELECT event_timestamp,
       properties_json->>'transaction_id'                   AS transaction_id,
       (properties_json->>'value')::numeric                 AS value,
       properties_json->>'currency'                         AS currency,
       properties_json->'@root'->>'email_sha256'            AS email_sha256
FROM datafly.events
WHERE event_name = 'purchase'
ORDER BY event_timestamp DESC
LIMIT 10;

Signal does not write mapped fields to their own columns; create views over properties_json for the fields you query often. What else a row carries outside the blueprint (the whole event context) is under review in #1414.

Stored event context

Alongside the fields your blueprint maps (where email, phone, names and address are stored as normalised SHA-256 by default), each row carries the event’s collected context exactly as Signal received it. The blueprint does not filter or hash the context: this is deliberate (decision 2026-09-23), so the context is complete for attribution, fraud and debugging queries, and it is listed here so you can decide what to keep.

StoredWhat it contains
Visitor requestIP address, user agent, Accept-Language, locale and timezone
PageURL including its query string, path, title and referrer
CampaignUTM source, medium, campaign, term and content
ConsentThe visitor’s consent state
LocationGeoIP country, region and city, and the network (ASN)
DeviceScreen size; for app events the OS and version, manufacturer, model, advertising ID and IDFV when the app collected them
Vendor IDsCookie and click identifiers in vendor_ids (for example the _fbp browser ID, gclid, ttclid, the GA client ID)
Session and librarySession ID, number and engagement time; the collector’s name and version
Partner attributesProfile attributes from partner enrichment (partner_attrs)

They are written to the ip_address, user_agent, page_url, page_path and page_referrer columns and, in full, to the context_json column, beside anonymous_id and user_id. Click and collected IDs outside the context are stored only where the blueprint maps them.

The IP address, device and advertising IDs, and cookie and click identifiers are personal data under UK and EU GDPR. To keep any of them out of storage, strip, mask or hash the field for every integration with the organisation data layer, apply URL redaction to page URLs, or remove it in the installed blueprint; and set the storage’s retention to match your privacy notice. See Personal data by integration.

Cloud SQL is a first-party destination under your control, gated by the same consent state as every other destination. Each stored event also records the visitor’s consent at collection time: the preset writes consent_analytics and consent_marketing under @root in the properties (properties_json), and the full consent object is in the context. Use them in views or queries if your governance needs a per-row consent filter.

Testing

  1. Enable the integration in Signal and trigger a test event on your website.

  2. Connect to the instance and query the target table:

    SELECT message_id, event_type, event_name, event_timestamp FROM datafly.events ORDER BY event_timestamp DESC LIMIT 10;
  3. Verify that event rows are appearing with correct data.

  4. In Signal, check the Live Events view to confirm delivery status shows as successful.

Troubleshooting

ProblemSolution
Connection refused / timeoutCheck authorised networks (public IP) or VPC peering (private IP).
Authentication failureVerify the database username and password.
permission deniedThe user lacks INSERT on the table, SELECT on its message_id column (PostgreSQL and SQL Server) or USAGE on the schema (PostgreSQL). Grant the required permissions.
SSL connection errorsPostgreSQL: ssl_mode=require. MySQL: paste the instance’s server CA into ca_certificate with tls_mode verify-ca (the Cloud SQL certificate names the instance, not the IP you connect to). SQL Server: ca_certificate with encrypt true. Behind the Cloud SQL Auth Proxy use ssl_mode=disable or leave tls_mode empty.
Relation does not existVerify the database, schema, and table names.
Slow insertsCheck the instance machine type and disk performance.

Visit Google Cloud SQL documentation for full API reference, connection methods, and backup configuration.

See also