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.44.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for database_wrapper_mssql-0.1.44.tar.gz
Algorithm Hash digest
SHA256 9ad6f8fe8a0d4a933ef7565a94fbd5df4148205513cd878c801459e0a4ee8474
MD5 9e5654f487d650fa2ca02ed138a576fd
BLAKE2b-256 a8cba37378c933130708f768c3615e91e076e0d64a145af8191676d7b50bc0e5

See more details on using hashes here.

Provenance

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

Publisher: master.yml on gintsmurans/py_database_wrapper

Attestations:

File details

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

File metadata

File hashes

Hashes for database_wrapper_mssql-0.1.44-py3-none-any.whl
Algorithm Hash digest
SHA256 872ef9dc343b6f44497d3b455fa336a7d66dfa5faf8edabe1f427463df06e36f
MD5 2faafa3a6b4c9d6a754a2fcb48db49b8
BLAKE2b-256 f0b88ecbc2a62922e974ef9ee28f4ea5993bfbb6ab1530e64dd5db15cc8ceb69

See more details on using hashes here.

Provenance

The following attestation bundles were made for database_wrapper_mssql-0.1.44-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