Skip to main content

database_wrapper for MSSQL database

Project description

database_wrapper

Part of the database_wrapper package.

This python package is a database wrapper for MSSQL databases.

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,
    """
        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.28.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

database_wrapper_mssql-0.1.28-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for database_wrapper_mssql-0.1.28.tar.gz
Algorithm Hash digest
SHA256 dc089e0b1bd5ac740c2079dd635b048465ab83625806e11fb4e084eac58fd68b
MD5 4575cbc9b6f486a91450bba483b1f385
BLAKE2b-256 533cd543e8ffa9a4f6fc2a5b92d86bec782d5600bac5d45b21b185684a280004

See more details on using hashes here.

Provenance

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

Publisher: master.yml on gintsmurans/py_database_wrapper

Attestations:

File details

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

File metadata

File hashes

Hashes for database_wrapper_mssql-0.1.28-py3-none-any.whl
Algorithm Hash digest
SHA256 76f628e336747dff0f7e5d0a2b4026cc0054222a9bb532354eaa150418d27684
MD5 c5912dccf54a604db51231319406a952
BLAKE2b-256 09cc02bf6ff40016807a8f93abb2f944b906bb101dd0c8cc92bcb6113bf591a4

See more details on using hashes here.

Provenance

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