Skip to main content

database_wrapper for MSSQL database

Project description

database_wrapper_mssql

Part of the database_wrapper package.

This python package is a database wrapper for MSSQL database.

Installation

pip install database_wrapper[mssql]

Usage

from database_wrapper_mssql import MSSQL, DBWrapperMSSQL

db = MSSQL({
    "hostname": "localhost",
    "port": "1433",
    "username": "sa",
    "password": "your_password",
    "database": "master"
})
db.open()
dbWrapper = DBWrapperMSSQL(db=db)

# 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()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

database_wrapper_mssql-0.1.43.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

database_wrapper_mssql-0.1.43-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file database_wrapper_mssql-0.1.43.tar.gz.

File metadata

File hashes

Hashes for database_wrapper_mssql-0.1.43.tar.gz
Algorithm Hash digest
SHA256 26efd2a397354aed73c1e748dc686db5f927ca3d79a72bb1156f44651db755b8
MD5 96eab2f4b164fee805932c959ac16ccb
BLAKE2b-256 f5cbc1bab0917511f22c1bb0a8480232ecbe5b79b5ea4047116ad2fc32a65fba

See more details on using hashes here.

Provenance

The following attestation bundles were made for database_wrapper_mssql-0.1.43.tar.gz:

Publisher: master.yml on gintsmurans/py_database_wrapper

Attestations:

File details

Details for the file database_wrapper_mssql-0.1.43-py3-none-any.whl.

File metadata

File hashes

Hashes for database_wrapper_mssql-0.1.43-py3-none-any.whl
Algorithm Hash digest
SHA256 fb728c527f826c6b0a273141b3ed1bcc4bf2d7170b1be95b4ee54ecfacf1f918
MD5 2e39237c7621fb1f05e73574a2b63ad6
BLAKE2b-256 8db0244b30bd2f50e9dc9682c749a655572d39655eb16209de8be4817251f21a

See more details on using hashes here.

Provenance

The following attestation bundles were made for database_wrapper_mssql-0.1.43-py3-none-any.whl:

Publisher: master.yml on gintsmurans/py_database_wrapper

Attestations:

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page