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.2.tar.gz (2.5 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.2-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sql_upsert-0.1.2.tar.gz
  • Upload date:
  • Size: 2.5 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.2.tar.gz
Algorithm Hash digest
SHA256 5d71544522c17aee84aca0e1db93f390ecee11c976339c3fe7608ea5af47e024
MD5 c2a1248113587c7b446c9707f150ef9a
BLAKE2b-256 470e182afa83c54d1292d503129f24c05c87d4c08c92755dc01140945eac008d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sql_upsert-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5c585faa6931312df440b1317c2ba40ca48516dbca5da0d983740b94a6d23903
MD5 1485d1211c392391a30700ca19a3a405
BLAKE2b-256 fa9e0c935491a66c478729af0a966c1b42de1b4dccd525ba52bf19d3cf4772a7

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