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
from sql_upsert import to_sql_upsert
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
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
Release history Release notifications | RSS feed
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.0.tar.gz
(2.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sql_upsert-0.1.0.tar.gz.
File metadata
- Download URL: sql_upsert-0.1.0.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
26ee9a60225a8b3ddade42f14e68c6b79bd0884b8bab1def12b6b5b1481b81d3
|
|
| MD5 |
d11bb63f87a07262067047672db1f1f8
|
|
| BLAKE2b-256 |
499dcb246f8fbf25929b627b69714b84c16e211c3ad139545846f59b3d3be54e
|
File details
Details for the file sql_upsert-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sql_upsert-0.1.0-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06b0009a256c2f71cc5855442e0a0b0697e34a15d52e481ad35b5f109beb31dc
|
|
| MD5 |
665215c0690257bd9bff9edcd80d4d86
|
|
| BLAKE2b-256 |
7f303efaa1c5a8564edb1f196958e5e32e5bbcb6ce0a375881990230420f7b9d
|