How to Install the Snowflake FDW Extension in PostgreSQL

Galaxy Glossary

How do I install the Snowflake FDW extension in PostgreSQL?

Install Snowflake FDW lets PostgreSQL query Snowflake tables as if they were local.

Sign up for the latest in SQL knowledge from the Galaxy Team!
Welcome to the Galaxy, Guardian!
Oops! Something went wrong while submitting the form.

Description

What does “install Snowflake” mean in PostgreSQL?

Installing Snowflake in PostgreSQL usually refers to adding the snowflake_fdw extension. This Foreign Data Wrapper (FDW) lets you read and write Snowflake data from Postgres using regular SQL.

How do I install the Snowflake FDW extension?

Run CREATE EXTENSION snowflake_fdw; in a superuser session. Optionally specify SCHEMA or VERSION as shown in the syntax section.

Why choose an FDW instead of ETL?

FDWs avoid data duplication, allow real-time access, and keep SQL identical across systems.They are ideal for ad-hoc queries or small data sets.

How do I connect PostgreSQL to Snowflake after installation?

Create a foreign server with Snowflake account details, then map users and import the target tables.

Can I filter or join Snowflake tables with local ones?

Yes.Once the FDW is active, you can SELECT, JOIN, and even INSERT/UPDATE if write privileges are enabled, just like normal Postgres tables.

Best practices for production use?

Use connection pooling, limit the columns you import, and push down filters with WHERE clauses to minimize data transfer.

Common pitfalls and how to avoid them

See the common mistakes section below for quick fixes.

.

Why How to Install the Snowflake FDW Extension in PostgreSQL is important

How to Install the Snowflake FDW Extension in PostgreSQL Example Usage


-- Example: join Snowflake ‘Orders’ with local ‘Customers’
SELECT c.id, c.name, o.total_amount
FROM Customers  AS c
JOIN Orders_fdw AS o ON o.customer_id = c.id
WHERE o.order_date >= CURRENT_DATE - INTERVAL '30 days'
ORDER BY o.total_amount DESC;

How to Install the Snowflake FDW Extension in PostgreSQL Syntax


CREATE EXTENSION IF NOT EXISTS snowflake_fdw
    [WITH] SCHEMA schema_name
    [VERSION version];

-- After installation
CREATE SERVER snowflake_srv
    FOREIGN DATA WRAPPER snowflake_fdw
    OPTIONS (
        host        '<account>.snowflakecomputing.com',
        port        '443',
        user        '<USER_NAME>',
        password    '<PASSWORD>',
        dbname      '<WAREHOUSE_DB>',
        warehouse   '<WAREHOUSE_NAME>'
    );

CREATE USER MAPPING FOR app_user
    SERVER snowflake_srv
    OPTIONS (user '<SF_USER>', password '<SF_PASS>');

IMPORT FOREIGN SCHEMA public LIMIT TO (Customers, Orders, Products, OrderItems)
    FROM SERVER snowflake_srv INTO public;

Common Mistakes

Frequently Asked Questions (FAQs)

Is snowflake_fdw officially supported?

No, it is community-maintained. Test thoroughly before production use.

Does FDW support parameterized queries?

Yes. Place parameters in the WHERE clause to push filters down to Snowflake.

Can I write data back to Snowflake?

INSERT, UPDATE, and DELETE work if your Snowflake role has the correct privileges and the FDW build supports writable foreign tables.

Want to learn about other SQL terms?

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo
Welcome to the Galaxy, Guardian!
Oops! Something went wrong while submitting the form.