Skip to main content

Reusable module for uploading datasets to Snowflake via stage

Project description

Flakepipe

PyPI Python License Build Status Codecov

Flakepipe is a lightweight, reusable Python module for uploading datasets to Snowflake via secure staging.

It automates table creation, column normalization, and data ingestion using Snowflake’s PUT and COPY INTO commands – making it ideal for ETL pipelines, scraping workflows, and reproducible data transfers.


📦 Features

  • Upload CSV files to Snowflake via PUT and COPY INTO
  • Automatically create or truncate target tables
  • Normalize column names to be Snowflake-compatible
  • Support for prefix/postfix-based table naming
  • Modular, testable, and production-friendly design

⚙️ Installation

Clone or download this package and install with:

pip install -e .

Or install dependencies only:

pip install -r requirements.txt

🧩 Configuration

You must provide a config dictionary with Snowflake connection parameters:

config = {
    'SF_USER': 'your_user',
    'SF_PASSWORD': 'your_password',
    'SF_ACCOUNT': 'your_account',
    'SF_ROLE': 'your_role',
    'SF_DATABASE': 'your_database',
    'SF_WAREHOUSE': 'your_warehouse',
}

🚀 Usage

Upload a CSV file

from flakepipe.uploader import upload_csv_to_snowflake
from your_project.config import access_settings as config

upload_csv_to_snowflake(
    config=config,
    file_path='output.csv',
    schema='MY_SCHEMA',
    table_name='my_table',
    truncate=True,
    overwrite=False,
    prefix='daily',
    postfix='20250705'
)

Truncate a table manually

from flakepipe.uploader import truncate_table
from flakepipe.connection import get_engine

engine = get_engine(config, schema='MY_SCHEMA')
truncate_table(engine, 'MY_TABLE')
engine.dispose()

🛠 Dependencies

Listed in requirements.txt, including:

  • SQLAlchemy >= 1.4.15
  • snowflake-connector-python >= 2.8.1
  • snowflake-sqlalchemy >= 1.2.4
  • pandas >= 1.4.0, < 2.1
  • numpy>=1.21.0, <1.26.0

✅ Tested with pandas 1.2.4 to 1.5.3
⚠️ Compatibility with pandas 2.x is expected but not officially guaranteed


📄 License

This project is licensed under the MIT License.


🤝 Contributing

Contributions, suggestions, and issues are welcome!
Please see CONTRIBUTING.md for guidelines.


🌍 Why Flakepipe?

Flakepipe was born from repeated use in real-world data workflows, especially in scraping and ETL projects.
Instead of rewriting boilerplate Snowflake ingestion code, this tool wraps best practices into a portable, documented, and open solution – freely available under an MIT license.

Whether you’re building one-off scripts or production pipelines – Flakepipe helps you do it right.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flakepipe-0.1.2.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flakepipe-0.1.2-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file flakepipe-0.1.2.tar.gz.

File metadata

  • Download URL: flakepipe-0.1.2.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for flakepipe-0.1.2.tar.gz
Algorithm Hash digest
SHA256 4a83352d69ebd4571ffab0dc91089fbe73dafd8333427c703856bccce4fc3bfa
MD5 8fa74f875675cc13104987bc9bc0a67d
BLAKE2b-256 8433941d91067437579f202a9123458ae0ab288273e7944c778dbb463511d480

See more details on using hashes here.

File details

Details for the file flakepipe-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: flakepipe-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for flakepipe-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5cc85ff5120f6c161027bcaab1537aae48efe8e1d4963b42e941bf9f72798af7
MD5 c4b0734179382578da7b2a830e58e6fe
BLAKE2b-256 5ce5ae8d91c6d3c156badf45aca194b36537c8790e15358dbce5f0d5bb07100d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page