Skip to main content

mkpipe-loader-snowflake

Snowflake loader plugin for MkPipe. Writes Spark DataFrames into Snowflake tables using the native Snowflake Spark connector (spark-snowflake), which stages data via internal cloud storage (S3/Azure/GCS) — significantly faster than JDBC for large datasets.

Documentation

For more detailed documentation, please visit the GitHub repository.

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.


Connection Configuration

connections:
  snowflake_target:
    variant: snowflake
    host: myaccount.snowflakecomputing.com
    port: 443
    database: MY_DATABASE
    schema: MY_SCHEMA
    user: myuser
    password: mypassword
    warehouse: MY_WAREHOUSE

With RSA key pair authentication:

connections:
  snowflake_target:
    variant: snowflake
    host: myaccount.snowflakecomputing.com
    port: 443
    database: MY_DATABASE
    schema: MY_SCHEMA
    user: myuser
    warehouse: MY_WAREHOUSE
    private_key_file: /path/to/rsa_key.p8
    private_key_file_pwd: mypassphrase

Table Configuration

pipelines:
  - name: pg_to_snowflake
    source: pg_source
    destination: snowflake_target
    tables:
      - name: public.events
        target_name: STG_EVENTS
        replication_method: full
        batchsize: 50000

Write Strategy

Control how data is written to Snowflake:

      - name: public.events
        target_name: STG_EVENTS
        write_strategy: upsert       # append | replace | upsert | merge
        write_key: [id]              # required for upsert/merge
Strategy Snowflake Behavior
append Insert via Spark connector (default for incremental)
replace Overwrite table via Spark connector (default for full). With if_exists: append: truncate + insert (preserves schema/indexes)
upsert Write to temp table, then MERGE INTO target USING temp ON ... WHEN MATCHED THEN UPDATE ... WHEN NOT MATCHED THEN INSERT ...
merge Same as upsert for Snowflake

Note: upsert/merge requires write_key. The loader creates a temp table, writes data there, executes a MERGE statement, then drops the temp table.


Write Parallelism & Throughput

Snowflake loader uses the native Spark connector. Two parameters control write performance:

      - name: public.events
        target_name: STG_EVENTS
        replication_method: full
        batchsize: 50000        # rows per batch insert (default: 10000)
        write_partitions: 4     # coalesce DataFrame to N partitions before writing

How they work

  • batchsize: number of rows buffered before sending to Snowflake. Larger batches reduce round-trips and staging overhead.
  • write_partitions: calls coalesce(N) on the DataFrame before writing, controlling the number of concurrent write operations to Snowflake.

Performance Notes

  • Snowflake Warehouse size is the primary write performance lever. A larger warehouse processes inserts faster regardless of partition count.
  • The Spark connector stages data internally before committing. Large batchsize (50,000+) reduces staging overhead.
  • For very large loads, consider using Snowflake's native COPY INTO via an external stage (S3/GCS) instead — that is significantly faster but requires additional infrastructure.
  • write_partitions: 4–8 is a good default to balance throughput and connection count.

All Table Parameters

Parameter Type Default Description
name string required Source table name
target_name string required Snowflake destination table name
replication_method full / incremental full Replication strategy
batchsize int 10000 Rows per batch insert
write_partitions int — Coalesce DataFrame to N partitions before writing
write_strategy string — append, replace, upsert, merge
write_key list — Key columns for upsert/merge (required)
if_exists string — replace (drop+create) or append (preserve table, truncate+insert). Inherits from settings
dedup_columns list — Columns used for mkpipe_id hash deduplication
tags list [] Tags for selective pipeline execution
pass_on_error bool false Skip table on error instead of failing

Metadata

Release files for mkpipe-loader-snowflake 0.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mkpipe-loader-snowflake 0.10.0
File Size Uploaded Provenance
mkpipe_loader_snowflake-0.10.0.tar.gz 9.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mkpipe-loader-snowflake 0.10.0
File Interpreter ABI Platform
mkpipe_loader_snowflake-0.10.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.8 kB

Release files / mkpipe_loader_snowflake-0.10.0.tar.gz

Download URL mkpipe_loader_snowflake-0.10.0.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
e26d724e2009cbd5ba96d2eca8d84a005670d86595f2838c0beca28a7e9f96b8
BLAKE2b-256 checksum
How to use checksums
a838ebf40fbf236c83441ca0324a608a714b1e1cbcad8ac6c4d540c69e8dbb0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.16

Release files / mkpipe_loader_snowflake-0.10.0-py3-none-any.whl

Download URL mkpipe_loader_snowflake-0.10.0-py3-none-any.whl
Size 10.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f47c0114b7adc97c3d9b10b2c1c5dbeb513be5c3ec14d1855313e5f7f146d756
BLAKE2b-256 checksum
How to use checksums
5c80c4970e88e22af1b2bcec575a6de4ffbfc3ed2e72b09a4ad67f25052742a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.16

Security for mkpipe-loader-snowflake 0.10.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page