tonydbc


Nametonydbc JSON
Version 1.0.7 PyPI version JSON
download
home_pageNone
SummaryA high-level database connector for MariaDB
upload_time2024-04-09 06:17:04
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT License Copyright (c) 2024 Fling Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords mariadb database connector odbc pandas
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # TonyDBC

Latest version: 1.0.7

Available on PyPI: https://pypi.org/project/tonydbc/

2024-01-07: [Release announcement on Medium](https://mcurrie-59915.medium.com/introducing-tonydbc-a-high-level-database-connector-for-mariadb-python-and-pandas-8600676fbf88)

Supports high-level database operations within Python.  TonyDBC is short for Tony’s Database Connector, named for Maria’s lover in West Side Story.

TonyDBC uses the MariaDB/Connector but adds these features:

* Support for the object-oriented context manager design pattern, which automatically closes connections.
* A way to convert between pandas DataFrames and MariaDB tables, including serialization of complex data types like dictionaries and numpy arrays.
* A way to autoresume when the connection is lost.
* Support for fast INSERT and UPDATE from DataFrame.to_sql. Currently pandas’ implemention using sqlalchemy is 300x slower.
* A way to quickly and automatically clone a database from a DDL script and copy the contents from the production database.
* Batch INSERT and UPDATE offline and resume when Internet is available.
* Logging database actions using the standard logging module.
* In a CI/CD context, automatically connecting to the correct production or test database.
* Support for the np.Int64Dtype data type.
* Support for pandas timestamps.
* Able to bulk insert data containing NULLs

### Installation

To install TonyDBC from PyPI:

```python
pip install tonydbc
```

### Usage

A typical use case:

```python
from tonydbc import TonyDBC, load_dotenvs

load_dotenvs()

sql_params = {
    "host": os.environ["MYSQL_HOST"],
    "user": os.environ["MYSQL_USER"],
    "password": os.environ["MYSQL_PASSWORD"],
    "database": os.environ["MYSQL_DATABASE"],
    "port": int(os.environ["MYSQL_PORT"]),
}

with TonyDBC(**sql_params) as db:
    # Do stuff
    pass
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "tonydbc",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "mariadb, database, connector, ODBC, pandas",
    "author": null,
    "author_email": "Michael Currie <mcurrie@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/3c/57/9c3e62cc1fb8a342b1ac11c3d839b1831e836dee1d26d542e7b776d74171/tonydbc-1.0.7.tar.gz",
    "platform": null,
    "description": "# TonyDBC\r\n\r\nLatest version: 1.0.7\r\n\r\nAvailable on PyPI: https://pypi.org/project/tonydbc/\r\n\r\n2024-01-07: [Release announcement on Medium](https://mcurrie-59915.medium.com/introducing-tonydbc-a-high-level-database-connector-for-mariadb-python-and-pandas-8600676fbf88)\r\n\r\nSupports high-level database operations within Python.  TonyDBC is short for Tony\u2019s Database Connector, named for Maria\u2019s lover in West Side Story.\r\n\r\nTonyDBC uses the MariaDB/Connector but adds these features:\r\n\r\n* Support for the object-oriented context manager design pattern, which automatically closes connections.\r\n* A way to convert between pandas DataFrames and MariaDB tables, including serialization of complex data types like dictionaries and numpy arrays.\r\n* A way to autoresume when the connection is lost.\r\n* Support for fast INSERT and UPDATE from DataFrame.to_sql. Currently pandas\u2019 implemention using sqlalchemy is 300x slower.\r\n* A way to quickly and automatically clone a database from a DDL script and copy the contents from the production database.\r\n* Batch INSERT and UPDATE offline and resume when Internet is available.\r\n* Logging database actions using the standard logging module.\r\n* In a CI/CD context, automatically connecting to the correct production or test database.\r\n* Support for the np.Int64Dtype data type.\r\n* Support for pandas timestamps.\r\n* Able to bulk insert data containing NULLs\r\n\r\n### Installation\r\n\r\nTo install TonyDBC from PyPI:\r\n\r\n```python\r\npip install tonydbc\r\n```\r\n\r\n### Usage\r\n\r\nA typical use case:\r\n\r\n```python\r\nfrom tonydbc import TonyDBC, load_dotenvs\r\n\r\nload_dotenvs()\r\n\r\nsql_params = {\r\n    \"host\": os.environ[\"MYSQL_HOST\"],\r\n    \"user\": os.environ[\"MYSQL_USER\"],\r\n    \"password\": os.environ[\"MYSQL_PASSWORD\"],\r\n    \"database\": os.environ[\"MYSQL_DATABASE\"],\r\n    \"port\": int(os.environ[\"MYSQL_PORT\"]),\r\n}\r\n\r\nwith TonyDBC(**sql_params) as db:\r\n    # Do stuff\r\n    pass\r\n```\r\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Fling  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "A high-level database connector for MariaDB",
    "version": "1.0.7",
    "project_urls": {
        "Homepage": "https://github.com/Fling-Asia/tonydbc"
    },
    "split_keywords": [
        "mariadb",
        " database",
        " connector",
        " odbc",
        " pandas"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "52e5e620df0a18cefb27830c55e13a1c5733863af5998c1af8b5742d8dd7cbf3",
                "md5": "0e60e69acf060b28bcbec32deb08efbe",
                "sha256": "c0c8cef81ecb10cbf59b3a78a2204fde0c9459a42aa93f8335b01b6d760326cc"
            },
            "downloads": -1,
            "filename": "tonydbc-1.0.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0e60e69acf060b28bcbec32deb08efbe",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 30235,
            "upload_time": "2024-04-09T06:17:01",
            "upload_time_iso_8601": "2024-04-09T06:17:01.999965Z",
            "url": "https://files.pythonhosted.org/packages/52/e5/e620df0a18cefb27830c55e13a1c5733863af5998c1af8b5742d8dd7cbf3/tonydbc-1.0.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3c579c3e62cc1fb8a342b1ac11c3d839b1831e836dee1d26d542e7b776d74171",
                "md5": "ec0f615a0f07e21801bc3b0e63d4cf11",
                "sha256": "d357c62f6eddff42e1cb1f24d2235660b1aa39434dbbf0ffa050f563a8bb6750"
            },
            "downloads": -1,
            "filename": "tonydbc-1.0.7.tar.gz",
            "has_sig": false,
            "md5_digest": "ec0f615a0f07e21801bc3b0e63d4cf11",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 28688,
            "upload_time": "2024-04-09T06:17:04",
            "upload_time_iso_8601": "2024-04-09T06:17:04.766839Z",
            "url": "https://files.pythonhosted.org/packages/3c/57/9c3e62cc1fb8a342b1ac11c3d839b1831e836dee1d26d542e7b776d74171/tonydbc-1.0.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-09 06:17:04",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Fling-Asia",
    "github_project": "tonydbc",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "tonydbc"
}
        
Elapsed time: 0.23148s