Skip to main content

pydbc driver for Microsoft SQL Server — wraps pymssql

Project description

alt-python-pydbc-mssql

pydbc driver for Microsoft SQL Server via pymssql.


Installation

uv add alt-python-pydbc-mssql

URL format

pydbc:mssql://user:password@host:port/database

The port defaults to 1433 if omitted.


Usage

import pydbc_mssql  # registers MssqlDriver with DriverManager
from pydbc_core import DriverManager

conn = DriverManager.get_connection("pydbc:mssql://user:pw@localhost:1433/mydb")
stmt = conn.create_statement()
rs = stmt.execute_query("SELECT 1 AS n")
print(rs.rows)   # [(1,)]
conn.close()

Parameterised queries

# Positional parameters
stmt = conn.create_statement()
rs = stmt.execute_query("SELECT * FROM users WHERE id = ?", (42,))

# Named parameters
rs = stmt.execute_query("SELECT * FROM users WHERE id = :id", {"id": 42})

Prepared statements

ps = conn.prepare_statement("INSERT INTO users (name, email) VALUES (?, ?)")
ps.execute_update(("Alice", "alice@example.com"))
conn.commit()

Paramstyle note

pymssql uses pyformat (%s / %(name)s) placeholders internally. pydbc accepts both ? (positional) and :name (named) syntax and translates automatically — you never need to know which style the underlying driver uses.


Documentation


License

MIT

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

alt_python_pydbc_mssql-1.0.0.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

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

alt_python_pydbc_mssql-1.0.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file alt_python_pydbc_mssql-1.0.0.tar.gz.

File metadata

  • Download URL: alt_python_pydbc_mssql-1.0.0.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for alt_python_pydbc_mssql-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d0d1d02927aa1b19ab74f9ba6699d462c2b32566d5c09232d9c508272a2526c1
MD5 04e5759dac3e3e3d72fe8a7dacf2a997
BLAKE2b-256 9aa892f04f9bce1aad90f00d1273dcaf8e39a713b46adbeedad8112e4cc5b084

See more details on using hashes here.

File details

Details for the file alt_python_pydbc_mssql-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: alt_python_pydbc_mssql-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for alt_python_pydbc_mssql-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3b6e86e13a42d2700c39669f0cf72ff2efecabf2cf8d21e98065e5c58804042c
MD5 52dcf395e122fdadd45a2eb4827335db
BLAKE2b-256 52feed6af8b2084c4f437af35e94176aae382c45f65dda0a577484a630e450f3

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