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

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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: database_wrapper_mssql-0.2.7.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for database_wrapper_mssql-0.2.7.tar.gz
Algorithm Hash digest
SHA256 e7aa87879045b2ed0ade1c4f7b6e0952999c64b0c033207c4d6ce65907ce19c7
MD5 e73dcb7b48f154a39a4a3ddc3da0c58b
BLAKE2b-256 82d5d157b58f5d3ec7ea2b08d2a6ef5adfb87237f6a7b24915d873578bc1e482

See more details on using hashes here.

Provenance

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

Publisher: master.yml on gintsmurans/py_database_wrapper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for database_wrapper_mssql-0.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 0bf66f815896d83a0716607785c35e109c144ee8e7c703854b2f62fada810bf3
MD5 c184b16909d027c9c97c95116e012c9b
BLAKE2b-256 e023fb17ba6b6a958968b85de7a4bbfc3da1d94dc044c74861c1116ef53b0bb4

See more details on using hashes here.

Provenance

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

Publisher: master.yml on gintsmurans/py_database_wrapper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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