Name | sqlalchemybulk JSON |
Version |
0.1.7
JSON |
| download |
home_page | None |
Summary | Perform CRUD operations with SQLAlchemy |
upload_time | 2025-02-13 14:40:14 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.7 |
license | MIT License
Copyright (c) 2024 sudonorm
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 |
database
sqlalchemy
upsert
bulk
orm
crud
|
VCS |
 |
bugtrack_url |
|
requirements |
pandas
numpy
SQLAlchemy
alembic
packaging
bumpver
build
twine
ipykernel
notebook
python-dotenv
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
sqlalchemy-bulk
==================
*Perform Create, Update, Read, and Delete operations easily using the SQLAlchemy orm*
---
Installation
-------------
To install via pip::
pip install sqlalchemybulk
Or download the source code and install manually::
git clone https://github.com/sudonorm/sqlalchemy-bulk.git
cd sqlalchemy-bulk/
python -m pip install .
Or download the source code and use the `setup.py` file::
git clone https://github.com/sudonorm/sqlalchemy-bulk.git
cd sqlalchemy-bulk/
python setup.py install
Be sure to add a .env to the root of the project with at least these variables (DB_URI, ALEMBIC_PATH)::
DB_URI="postgresql+psycopg2://username:password@host:port/database_name"
ALEMBIC_PATH="<path/to/user/project/root/folder>"
# "SQLITE_DB_PATH" is optional, except you are testing with a SQLite DB.
SQLITE_DB_PATH="<path/to/user/folder>/test.db"
Basic usage
-----------
.. code:: python
from sqlalchemybulk.crud_helper_funcs import UploadData, DownloadData, DeleteData
import pandas as pd
from sqlalchemy import select, delete
from tests.sample_data.dataModel import engine
from tests.sample_data import dataModel
## Insert (Create) or Update
upload_data = UploadData(engine=engine)
returned_ids = upload_data.upload_info_atomic(dbTable='dataModel.Address', df=df, unique_idx_elements=['name', 'postalZip'], column_update_fields=['address', 'country', 'suptext', 'numberrange', 'currency', 'alphanumeric'])
## Download (Read)
download_data = DownloadData(engine=engine)
### query full table
query = select(dataModel.Address)
result = download_data.download_info_using_session(statement=query)
### query with filter
query = select(dataModel.Address).where(dataModel.Address.postalZip == "3778")
result = download_data.download_info_using_session(statement=query)
## Delete
delete_data = DeleteData(engine=engine)
query = delete(dataModel.Address).where(dataModel.Address.postalZip == "15143")
delete_data.delete_data_on_condition(dbTable="dataModel.Address", statement=query)
Bugs, requests, questions, etc.
-------------------------------
Please create an `issue on GitHub <https://github.com/sudonorm/sqlalchemy-bulk/issues>`_.
Raw data
{
"_id": null,
"home_page": null,
"name": "sqlalchemybulk",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "database, sqlalchemy, upsert, bulk, orm, crud",
"author": null,
"author_email": "sudonorm <sudonorm@protonmail.com>",
"download_url": "https://files.pythonhosted.org/packages/12/f0/dd89da37819518ed8156e336d962adf6027f9553c4657f3057297a9e123b/sqlalchemybulk-0.1.7.tar.gz",
"platform": null,
"description": "sqlalchemy-bulk\n==================\n\n*Perform Create, Update, Read, and Delete operations easily using the SQLAlchemy orm*\n\n---\n\nInstallation\n-------------\n\nTo install via pip::\n\n pip install sqlalchemybulk\n\nOr download the source code and install manually::\n\n git clone https://github.com/sudonorm/sqlalchemy-bulk.git\n cd sqlalchemy-bulk/\n python -m pip install .\n\nOr download the source code and use the `setup.py` file::\n\n git clone https://github.com/sudonorm/sqlalchemy-bulk.git\n cd sqlalchemy-bulk/\n python setup.py install\n\nBe sure to add a .env to the root of the project with at least these variables (DB_URI, ALEMBIC_PATH)::\n\n DB_URI=\"postgresql+psycopg2://username:password@host:port/database_name\"\n ALEMBIC_PATH=\"<path/to/user/project/root/folder>\"\n\n # \"SQLITE_DB_PATH\" is optional, except you are testing with a SQLite DB.\n\n SQLITE_DB_PATH=\"<path/to/user/folder>/test.db\"\n\nBasic usage\n-----------\n\n.. code:: python\n\n from sqlalchemybulk.crud_helper_funcs import UploadData, DownloadData, DeleteData\n import pandas as pd\n from sqlalchemy import select, delete\n from tests.sample_data.dataModel import engine\n from tests.sample_data import dataModel\n\n ## Insert (Create) or Update\n upload_data = UploadData(engine=engine)\n returned_ids = upload_data.upload_info_atomic(dbTable='dataModel.Address', df=df, unique_idx_elements=['name', 'postalZip'], column_update_fields=['address', 'country', 'suptext', 'numberrange', 'currency', 'alphanumeric'])\n\n ## Download (Read)\n download_data = DownloadData(engine=engine)\n\n ### query full table\n query = select(dataModel.Address)\n result = download_data.download_info_using_session(statement=query)\n\n ### query with filter\n query = select(dataModel.Address).where(dataModel.Address.postalZip == \"3778\")\n result = download_data.download_info_using_session(statement=query)\n\n ## Delete\n delete_data = DeleteData(engine=engine)\n query = delete(dataModel.Address).where(dataModel.Address.postalZip == \"15143\")\n delete_data.delete_data_on_condition(dbTable=\"dataModel.Address\", statement=query)\n\nBugs, requests, questions, etc.\n-------------------------------\n\nPlease create an `issue on GitHub <https://github.com/sudonorm/sqlalchemy-bulk/issues>`_.\n",
"bugtrack_url": null,
"license": "MIT License\n \n Copyright (c) 2024 sudonorm\n \n Permission is hereby granted, free of charge, to any person obtaining a copy\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n \n The above copyright notice and this permission notice shall be included in all\n copies or substantial portions of the Software.\n \n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n SOFTWARE.\n ",
"summary": "Perform CRUD operations with SQLAlchemy",
"version": "0.1.7",
"project_urls": {
"repository": "https://github.com/sudonorm/sqlalchemy-bulk"
},
"split_keywords": [
"database",
" sqlalchemy",
" upsert",
" bulk",
" orm",
" crud"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "d0d4351e3ad5fc24683f3d0462b0429678e8338649df347f26324ef897eb1b43",
"md5": "87eecaf5eea73883ac882f2913507993",
"sha256": "babcd575eac51ce1d149735f3dfb36ac11d6b47b2f265facd92dcacc0d8b99bc"
},
"downloads": -1,
"filename": "sqlalchemybulk-0.1.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "87eecaf5eea73883ac882f2913507993",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 18915,
"upload_time": "2025-02-13T14:40:11",
"upload_time_iso_8601": "2025-02-13T14:40:11.969733Z",
"url": "https://files.pythonhosted.org/packages/d0/d4/351e3ad5fc24683f3d0462b0429678e8338649df347f26324ef897eb1b43/sqlalchemybulk-0.1.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "12f0dd89da37819518ed8156e336d962adf6027f9553c4657f3057297a9e123b",
"md5": "d9cf6930d722f25bbdae7aafcfc23c19",
"sha256": "9a2ce4a9e71075e654a6fbe87e8a3f2cba66a23f3e58852da5d501bd4be99e4e"
},
"downloads": -1,
"filename": "sqlalchemybulk-0.1.7.tar.gz",
"has_sig": false,
"md5_digest": "d9cf6930d722f25bbdae7aafcfc23c19",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 17497,
"upload_time": "2025-02-13T14:40:14",
"upload_time_iso_8601": "2025-02-13T14:40:14.223124Z",
"url": "https://files.pythonhosted.org/packages/12/f0/dd89da37819518ed8156e336d962adf6027f9553c4657f3057297a9e123b/sqlalchemybulk-0.1.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-02-13 14:40:14",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "sudonorm",
"github_project": "sqlalchemy-bulk",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "pandas",
"specs": []
},
{
"name": "numpy",
"specs": []
},
{
"name": "SQLAlchemy",
"specs": []
},
{
"name": "alembic",
"specs": []
},
{
"name": "packaging",
"specs": []
},
{
"name": "bumpver",
"specs": []
},
{
"name": "build",
"specs": []
},
{
"name": "twine",
"specs": []
},
{
"name": "ipykernel",
"specs": []
},
{
"name": "notebook",
"specs": []
},
{
"name": "python-dotenv",
"specs": []
}
],
"lcname": "sqlalchemybulk"
}