Skip to main content

A lightweight module that wraps and extends the PyMSSQL library.

Project description

pymssql-utils (ALPHA)

A lightweight module that wraps and extends the pymssql library.

The aim of this module is to make it easier to use pymssql by:

  • Reducing the amount of boilerplate code needed, and being fully type hinted.
  • Baking in sensible defaults and good usage patterns.
  • Returning a helpful DatabaseResult class for each execution.
  • Parsing various SQL Types to native Python types that pymssql misses.
  • Making it easier to serialise your data.
  • Letting you easily choose how to handle errors.
  • Providing various utility functions for building dynamic SQL queries or logging query output.
  • Fixing various edge case bugs that arise when using pymssql.

The trade-off with "baking in" various patterns and options is that this module is opinionated as to what best practice is. This module does not strive to be the most performant or flexible way of using pymssql, for that just use pymssql. However, this module aims to make interfacing with a MS SQL server to be as hassle-free as possible, while making your code explicit and neat.

This module was created naturally over the course of a few years of using pymssql in various projects.

Please raise any suggestions or issues via GitHub.

Installation

This module can be installed via pip: pip install pymssql-utils.

This module requires Python >= 3.6 and Pip >= 19.3

Quick Start (TODO)

Running a simple query:

import os

import pymssqlutils as sql

os.environ["DB_NAME"] = "MASTER"

Notes

Why pymssql when Microsoft officially recommends pyodbc (opinion)?

The main difference between pyodbc and pymssql is the drivers they use. The ODBC are newer and have various levels of support on differing linux distributions, and if you develop for containers or distribute code onto different platforms you can run into ODBC driver-related issues that FreeTDS tends to not have.

There are other minor reasons someone might prefer pymssql, e.g.:

  • pymssql's parameter subsitution is done client-side improving operation visibility.
  • pymssql also has support for MSSQL specific data types such as Datetimeoffset.

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

pymssql-utils-0.0.5.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pymssql_utils-0.0.5-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file pymssql-utils-0.0.5.tar.gz.

File metadata

  • Download URL: pymssql-utils-0.0.5.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for pymssql-utils-0.0.5.tar.gz
Algorithm Hash digest
SHA256 b603cdfd7e5ef46c97dd9cca7f1f19fe7564e00c7f66b9736703cffb2a66962c
MD5 73ebda0aa93218f16cfd7181dcf6de97
BLAKE2b-256 520e6df17a9ca89f9ebcd6050b9d51a3554a5b23fb31e1dd1ac007736166c8cc

See more details on using hashes here.

File details

Details for the file pymssql_utils-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: pymssql_utils-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for pymssql_utils-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 120bbacab152ce5d7dd8c2f54b5645e2c5e228e062d9eec93e09e3d5a15b6572
MD5 e7908acf53e5ffe552a2470ba2bc46fa
BLAKE2b-256 5444e70e3a2c7b1c72362eba36d3590f7cdca7fa6d801a5c360d72d23d00d9cf

See more details on using hashes here.

Supported by

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