Skip to main content

A package for handling SQL upsert operations with pandas DataFrames

Project description

SQL Upsert

A Python package for handling SQL upsert operations with pandas DataFrames.

Installation

pip install sql_upsert

Usage

import sql_upsert as pdu
import pandas as pd
from sqlalchemy import create_engine

# Create engine
engine = create_engine('sqlite:///example.db')

# Create sample DataFrame
df = pd.DataFrame({'id': [1, 2], 'value': ['a', 'b']})

# Write with upsert functionality
pdu.to_sql_upsert(df, 'my_table', engine, unique_columns=['id'])

Features

  • Automatic handling of upsert operations
  • Support for custom unique constraints
  • Compatible with any SQLAlchemy supported database
  • Preserves column types when creating tables

Requirements

  • Python >= 3.6
  • SQLAlchemy >= 1.4.0
  • pandas >= 1.0.0

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

sql_upsert-0.1.1.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

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

sql_upsert-0.1.1-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file sql_upsert-0.1.1.tar.gz.

File metadata

  • Download URL: sql_upsert-0.1.1.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.1

File hashes

Hashes for sql_upsert-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ac40cfefbe3b1f1186b48f0c8c89112020346a9017826f78132d7a3b804dc282
MD5 d1ac3906e2623df114e495a4026fa650
BLAKE2b-256 5b941b6e7c2d296b08072804c5985250a97f8b0582b97f1254e87992ef268ff7

See more details on using hashes here.

File details

Details for the file sql_upsert-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: sql_upsert-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 2.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.1

File hashes

Hashes for sql_upsert-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a2caef9cb6846cadd963dd3cbf03e1fa7816c98e0f4a0647f03e96813c12d89c
MD5 c87b92d52f045436ed44d05cd1557e87
BLAKE2b-256 f3009abd7cd7f4e5c7b5b5d6446ddd3d1847121f05952ce82a7929e5dd3a3153

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