sql-upsert


Namesql-upsert JSON
Version 0.1.2 PyPI version JSON
download
home_pagehttps://github.com/vile319/sql_upsert
SummaryA package for handling SQL upsert operations with pandas DataFrames
upload_time2024-12-16 02:21:08
maintainerNone
docs_urlNone
authorvile319
requires_python>=3.6
licenseNone
keywords
VCS
bugtrack_url
requirements sqlalchemy pandas
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # SQL Upsert

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

## Installation

```bash
pip install sql_upsert
```

## Usage

```python
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 

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/vile319/sql_upsert",
    "name": "sql-upsert",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": null,
    "author": "vile319",
    "author_email": "vile319@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/47/0e/182afa83c54d1292d503129f24c05c87d4c08c92755dc01140945eac008d/sql_upsert-0.1.2.tar.gz",
    "platform": null,
    "description": "# SQL Upsert\r\n\r\nA Python package for handling SQL upsert operations with pandas DataFrames.\r\n\r\n## Installation\r\n\r\n```bash\r\npip install sql_upsert\r\n```\r\n\r\n## Usage\r\n\r\n```python\r\nimport sql_upsert as pdu\r\nimport pandas as pd\r\nfrom sqlalchemy import create_engine\r\n\r\n# Create engine\r\nengine = create_engine('sqlite:///example.db')\r\n\r\n# Create sample DataFrame\r\ndf = pd.DataFrame({'id': [1, 2], 'value': ['a', 'b']})\r\n\r\n# Write with upsert functionality\r\npdu.to_sql_upsert(df, 'my_table', engine, unique_columns=['id'])\r\n```\r\n\r\n## Features\r\n\r\n- Automatic handling of upsert operations\r\n- Support for custom unique constraints\r\n- Compatible with any SQLAlchemy supported database\r\n- Preserves column types when creating tables\r\n\r\n## Requirements\r\n\r\n- Python >= 3.6\r\n- SQLAlchemy >= 1.4.0\r\n- pandas >= 1.0.0 \r\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A package for handling SQL upsert operations with pandas DataFrames",
    "version": "0.1.2",
    "project_urls": {
        "Homepage": "https://github.com/vile319/sql_upsert"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fa9e0c935491a66c478729af0a966c1b42de1b4dccd525ba52bf19d3cf4772a7",
                "md5": "1485d1211c392391a30700ca19a3a405",
                "sha256": "5c585faa6931312df440b1317c2ba40ca48516dbca5da0d983740b94a6d23903"
            },
            "downloads": -1,
            "filename": "sql_upsert-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1485d1211c392391a30700ca19a3a405",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 2839,
            "upload_time": "2024-12-16T02:21:06",
            "upload_time_iso_8601": "2024-12-16T02:21:06.053843Z",
            "url": "https://files.pythonhosted.org/packages/fa/9e/0c935491a66c478729af0a966c1b42de1b4dccd525ba52bf19d3cf4772a7/sql_upsert-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "470e182afa83c54d1292d503129f24c05c87d4c08c92755dc01140945eac008d",
                "md5": "c2a1248113587c7b446c9707f150ef9a",
                "sha256": "5d71544522c17aee84aca0e1db93f390ecee11c976339c3fe7608ea5af47e024"
            },
            "downloads": -1,
            "filename": "sql_upsert-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "c2a1248113587c7b446c9707f150ef9a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 2452,
            "upload_time": "2024-12-16T02:21:08",
            "upload_time_iso_8601": "2024-12-16T02:21:08.301093Z",
            "url": "https://files.pythonhosted.org/packages/47/0e/182afa83c54d1292d503129f24c05c87d4c08c92755dc01140945eac008d/sql_upsert-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-16 02:21:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "vile319",
    "github_project": "sql_upsert",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "sqlalchemy",
            "specs": [
                [
                    ">=",
                    "1.4.0"
                ]
            ]
        },
        {
            "name": "pandas",
            "specs": [
                [
                    ">=",
                    "1.0.0"
                ]
            ]
        }
    ],
    "lcname": "sql-upsert"
}
        
Elapsed time: 0.75037s