The Simplest Way to Make PostgreSQL and Snowflake Work Like They Should

Published
Length
3 min read

Luis Felipe Dias

All posts

Teams pair postgresql and snowflake to move live app records into a central warehouse. PostgreSQL handles fast daily writes, while Snowflake runs big reports across history. This split keeps your main app fast while analysts run heavy queries. To make both tools work well, you must set up strict roles and safe data flows. How data and permissions flow between postgresql and snowflake Data moves from your transactional database into your analytics warehouse on a set schedule. Extraction jobs

Your coding agents run with your access.

Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.

Teams pair postgresql and snowflake to move live app records into a central warehouse. PostgreSQL handles fast daily writes, while Snowflake runs big reports across history.

This split keeps your main app fast while analysts run heavy queries. To make both tools work well, you must set up strict roles and safe data flows.

How data and permissions flow between postgresql and snowflake

Data moves from your transactional database into your analytics warehouse on a set schedule. Extraction jobs read new rows from source tables and send them to staging storage.

From staging, the warehouse loads the records into reporting tables for your team. Because the sync job reads source data all day, its source role needs strict limits.

In PostgreSQL, the SELECT privilege lets a role read from a table or view. You can also grant SELECT on specific columns of a table or materialized view. This privilege also lets the sync role export data out of the database.

If a table holds emails, phone numbers, or card numbers, skip those columns. Grant SELECT only on the safe columns that your warehouse needs for charts. Data masking can also rewrite matched fields in results before analysts query them.

You should also check the special PUBLIC role on your source database. By default, PUBLIC gives every role on the system the right to run functions. It also lets every role create temp tables and log in to databases. The object owner can revoke these default rights so sync accounts stay locked down.

PostgreSQL Access Control + Snowflake Access Control: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Common failure modes and how to scope roles

Many teams fail by using one shared admin account for all data pipelines. When an extraction job uses a broad role, one leaked key puts everything at risk. A bad query can lock source tables or drop data by mistake.

Shared accounts also ruin your audit logs across both systems. When five apps and ten analysts share one login, you cannot trace who ran a query. You need clear role boundaries on the source side and in your Snowflake session setup.

Start by setting up group roles in PostgreSQL to manage privileges for many users. You grant table rights to the group role, then add user accounts to that group. Create one dedicated read-only group for your warehouse sync tools and nothing else.

Next, lock down the public schema on your source database. In PostgreSQL 15 and later, regular users cannot create objects in the public schema by default. Older databases, or upgraded ones, still let the PUBLIC role create objects there. An admin should revoke that right from PUBLIC so sync roles cannot write tables.

Apply the same strict scoping when you configure each Snowflake role and warehouse session. Give ingestion services permissions to write only into raw staging schemas. Give human analysts separate read-only roles that query clean views in their Snowflake session. Restrict network paths so only known sync servers can talk to either system.

Govern statements and responses across databases and APIs

Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev runs beside each supported service as an open-source proxy, a sidecar for your database or API.

First, hoop.dev guardrails block banned queries before they run. Then hoop.dev data masking rewrites matched sensitive values in responses in memory. The audit trail records every statement and verdict per resource. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.

Frequently asked questions

How do I stop a sync job from reading sensitive columns in PostgreSQL?

Grant the SELECT privilege only on the exact columns that the warehouse needs. Leave out columns with emails, phone numbers, card numbers, or national IDs.

Why can my read-only sync user still create objects in PostgreSQL?

Databases created before PostgreSQL 15 let the PUBLIC role create objects in the public schema. An admin must revoke the CREATE right on the public schema from PUBLIC.

Should engineers and pipelines share the same Snowflake role?

No, pipelines and humans need separate roles with different permissions in every Snowflake session. Give pipelines write rights on staging tables, and give humans read rights on final views.

The query runs. The emails stay hidden.