# database_wrapper_mssql
_Part of the `database_wrapper` package._
This python package is a database wrapper for [MSSQL](https://www.microsoft.com/en-us/sql-server/sql-server-downloads) database.
## Installation
```bash
pip install database_wrapper[mssql]
```
## Usage
```python
from database_wrapper_mssql import MSSQL, DBWrapperMSSQL
db = MSSQL({
"hostname": "localhost",
"port": "1433",
"username": "sa",
"password": "your_password",
"database": "master"
})
db.open()
dbWrapper = DBWrapperMSSQL(dbCursor=db.cursor)
# Simple query
aModel = MyModel()
res = await dbWrapper.getByKey(
aModel,
"id",
3005,
)
if res:
print(f"getByKey: {res.toDict()}")
else:
print("No results")
# Raw query
res = await dbWrapper.getAll(
aModel,
customQuery="""
SELECT t1.*, t2.name AS other_name
FROM my_table AS t1
LEFT JOIN other_table AS t2 ON t1.other_id = t2.id
"""
)
async for record in res:
print(f"getAll: {record.toDict()}")
else:
print("No results")
db.close()
```
Raw data
{
"_id": null,
"home_page": null,
"name": "database-wrapper-mssql",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "database, wrapper, python, mssql, sqlserver",
"author": null,
"author_email": "Gints Murans <gm@gm.lv>",
"download_url": "https://files.pythonhosted.org/packages/67/11/5fd476131e38ae637df76347e95b8a047109e8c4844c66c7b2cc6b461b54/database_wrapper_mssql-0.1.73.tar.gz",
"platform": null,
"description": "# database_wrapper_mssql\n\n_Part of the `database_wrapper` package._\n\nThis python package is a database wrapper for [MSSQL](https://www.microsoft.com/en-us/sql-server/sql-server-downloads) database.\n\n## Installation\n\n```bash\npip install database_wrapper[mssql]\n```\n\n## Usage\n\n```python\nfrom database_wrapper_mssql import MSSQL, DBWrapperMSSQL\n\ndb = MSSQL({\n \"hostname\": \"localhost\",\n \"port\": \"1433\",\n \"username\": \"sa\",\n \"password\": \"your_password\",\n \"database\": \"master\"\n})\ndb.open()\ndbWrapper = DBWrapperMSSQL(dbCursor=db.cursor)\n\n# Simple query\naModel = MyModel()\nres = await dbWrapper.getByKey(\n aModel,\n \"id\",\n 3005,\n)\nif res:\n print(f\"getByKey: {res.toDict()}\")\nelse:\n print(\"No results\")\n\n# Raw query\nres = await dbWrapper.getAll(\n aModel,\n customQuery=\"\"\"\n SELECT t1.*, t2.name AS other_name\n FROM my_table AS t1\n LEFT JOIN other_table AS t2 ON t1.other_id = t2.id\n \"\"\"\n)\nasync for record in res:\n print(f\"getAll: {record.toDict()}\")\nelse:\n print(\"No results\")\n\ndb.close()\n```\n",
"bugtrack_url": null,
"license": "GNU General Public License v3.0 (GPL-3.0)",
"summary": "database_wrapper for MSSQL database",
"version": "0.1.73",
"project_urls": {
"Changes": "https://github.com/gintsmurans/py_database_wrapper",
"Code": "https://github.com/gintsmurans/py_database_wrapper",
"Documentation": "https://github.com/gintsmurans/py_database_wrapper",
"Download": "https://pypi.org/project/database_wrapper/",
"Homepage": "https://github.com/gintsmurans/py_database_wrapper",
"Issue Tracker": "https://github.com/gintsmurans/py_database_wrapper/issues"
},
"split_keywords": [
"database",
" wrapper",
" python",
" mssql",
" sqlserver"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9213f20c50cf9de28ee793ad04864c47992f7d901b3c272e010370c409484af5",
"md5": "4e7f354813849a3ed95388b1138d9016",
"sha256": "4cc49a4c8693fcb5d761085859207c43cdb6326db4070867c1d85a3890b606b4"
},
"downloads": -1,
"filename": "database_wrapper_mssql-0.1.73-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4e7f354813849a3ed95388b1138d9016",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 4426,
"upload_time": "2024-12-22T02:12:59",
"upload_time_iso_8601": "2024-12-22T02:12:59.014931Z",
"url": "https://files.pythonhosted.org/packages/92/13/f20c50cf9de28ee793ad04864c47992f7d901b3c272e010370c409484af5/database_wrapper_mssql-0.1.73-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "67115fd476131e38ae637df76347e95b8a047109e8c4844c66c7b2cc6b461b54",
"md5": "c7ee7934043cd2222f505b81cd19f3e2",
"sha256": "e3bcc1eefcd8c95b1d99a0e13b23f0ddee27af66d012f9ac88de2bac5417cc15"
},
"downloads": -1,
"filename": "database_wrapper_mssql-0.1.73.tar.gz",
"has_sig": false,
"md5_digest": "c7ee7934043cd2222f505b81cd19f3e2",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 3714,
"upload_time": "2024-12-22T02:13:09",
"upload_time_iso_8601": "2024-12-22T02:13:09.842475Z",
"url": "https://files.pythonhosted.org/packages/67/11/5fd476131e38ae637df76347e95b8a047109e8c4844c66c7b2cc6b461b54/database_wrapper_mssql-0.1.73.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-22 02:13:09",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "gintsmurans",
"github_project": "py_database_wrapper",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "database-wrapper-mssql"
}