dfupsert


Namedfupsert JSON
Version 0.0.4 PyPI version JSON
download
home_page
Summary"dfupsert" is a Python package for synchronizing pd.DataFrames with databases using seamless dfupsert (insert or update) operations.
upload_time2024-01-11 15:38:34
maintainer
docs_urlNone
authorGuangJun Liang
requires_python
license
keywords python pandas sql dfupsert update etl
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            


# dfupsert



## Overview

`dfupsert` is an efficient Python package designed for synchronizing pandas DataFrames with databases using upsert operations (insert or update). It works seamlessly with SQLAlchemy's well-defined table mappings, facilitating a smooth integration between pandas and various databases.



## Features

- **Streamlined Upsert Operations**: Facilitates upserts directly from pandas DataFrames to database tables using SQLAlchemy mappings.

- **Wide Database Compatibility**: Built on top of SQLAlchemy, it supports a diverse range of database systems.

- **Efficient Handling of Large DataSets**: Implements chunk-based data processing for optimized performance with large data volumes.

- **Customizable and User-Friendly**: Offers flexibility in connection types, table mappings, and chunk sizes to accommodate different use cases.



## Installation

Install `dfupsert` using pip:

```bash

pip install dfupsert

```



## Usage



```python

from dfupsert import upsert

from pandas import DataFrame

from sqlalchemy import create_engine

from your_application.model import YourTableClass  # Import your SQLAlchemy table class



# Example DataFrame

data = {'column1': [1, 2], 'column2': [3, 4]}

df = DataFrame(data)



# Establish a database connection using SQLAlchemy

engine = create_engine('your-database-connection-string')



# Upsert DataFrame into the database table

upsert(df=df, con=engine, table=YourTableClass, chunksize=1000)

```



## Requirements

- Python 3.x

- pandas

- SQLAlchemy



## Contributing

We welcome contributions to the `dfupsert`[github project](https://github.com/TommyLeung-gj/dfupsert).

## License

`dfupsert` is available under the MIT License. See the [MIT](https://choosealicense.com/licenses/mit/) or [LICENSE](LICENSE) file for more details.



## Support

For questions and support, please open an issue in the project's GitHub issue tracker.


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "dfupsert",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "python,pandas,sql,dfupsert,update,etl",
    "author": "GuangJun Liang",
    "author_email": "gaungjun_l@icloud.com",
    "download_url": "https://files.pythonhosted.org/packages/7b/cd/6e1d02c373449da6344e1bff614f027e33b33be8d6b88ea458c9ee7a64cb/dfupsert-0.0.4.tar.gz",
    "platform": null,
    "description": "\r\n\r\r\n# dfupsert\r\r\n\r\r\n## Overview\r\r\n`dfupsert` is an efficient Python package designed for synchronizing pandas DataFrames with databases using upsert operations (insert or update). It works seamlessly with SQLAlchemy's well-defined table mappings, facilitating a smooth integration between pandas and various databases.\r\r\n\r\r\n## Features\r\r\n- **Streamlined Upsert Operations**: Facilitates upserts directly from pandas DataFrames to database tables using SQLAlchemy mappings.\r\r\n- **Wide Database Compatibility**: Built on top of SQLAlchemy, it supports a diverse range of database systems.\r\r\n- **Efficient Handling of Large DataSets**: Implements chunk-based data processing for optimized performance with large data volumes.\r\r\n- **Customizable and User-Friendly**: Offers flexibility in connection types, table mappings, and chunk sizes to accommodate different use cases.\r\r\n\r\r\n## Installation\r\r\nInstall `dfupsert` using pip:\r\r\n```bash\r\r\npip install dfupsert\r\r\n```\r\r\n\r\r\n## Usage\r\r\n\r\r\n```python\r\r\nfrom dfupsert import upsert\r\r\nfrom pandas import DataFrame\r\r\nfrom sqlalchemy import create_engine\r\r\nfrom your_application.model import YourTableClass  # Import your SQLAlchemy table class\r\r\n\r\r\n# Example DataFrame\r\r\ndata = {'column1': [1, 2], 'column2': [3, 4]}\r\r\ndf = DataFrame(data)\r\r\n\r\r\n# Establish a database connection using SQLAlchemy\r\r\nengine = create_engine('your-database-connection-string')\r\r\n\r\r\n# Upsert DataFrame into the database table\r\r\nupsert(df=df, con=engine, table=YourTableClass, chunksize=1000)\r\r\n```\r\r\n\r\r\n## Requirements\r\r\n- Python 3.x\r\r\n- pandas\r\r\n- SQLAlchemy\r\r\n\r\r\n## Contributing\r\r\nWe welcome contributions to the `dfupsert`[github project](https://github.com/TommyLeung-gj/dfupsert).\r\r\n## License\r\r\n`dfupsert` is available under the MIT License. See the [MIT](https://choosealicense.com/licenses/mit/) or [LICENSE](LICENSE) file for more details.\r\r\n\r\r\n## Support\r\r\nFor questions and support, please open an issue in the project's GitHub issue tracker.\r\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "\"dfupsert\" is a Python package for synchronizing pd.DataFrames with databases using seamless dfupsert (insert or update) operations.",
    "version": "0.0.4",
    "project_urls": null,
    "split_keywords": [
        "python",
        "pandas",
        "sql",
        "dfupsert",
        "update",
        "etl"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7bcd6e1d02c373449da6344e1bff614f027e33b33be8d6b88ea458c9ee7a64cb",
                "md5": "c396ffe068e1cabb35245aae3df3de2d",
                "sha256": "aed1485e39863836c540524248f8f20e9fe85658b5c5b0ddf2fe00e273a01dfb"
            },
            "downloads": -1,
            "filename": "dfupsert-0.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "c396ffe068e1cabb35245aae3df3de2d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 8256,
            "upload_time": "2024-01-11T15:38:34",
            "upload_time_iso_8601": "2024-01-11T15:38:34.148870Z",
            "url": "https://files.pythonhosted.org/packages/7b/cd/6e1d02c373449da6344e1bff614f027e33b33be8d6b88ea458c9ee7a64cb/dfupsert-0.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-11 15:38:34",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "dfupsert"
}
        
Elapsed time: 0.15976s