Skip to main content

pydbc driver for MySQL — wraps PyMySQL (format paramstyle)

Project description

alt-python-pydbc-mysql

pydbc driver for MySQL — wraps PyMySQL with the pydbc unified DB access abstraction.


Installation

uv add alt-python-pydbc-mysql

Note: The cryptography package is installed automatically as a runtime dependency. It is required for MySQL 8.0's default caching_sha2_password authentication plugin — without it connections will fail. You do not need to install it separately.


URL format

pydbc:mysql://[user[:password]@]host[:port]/database

The port defaults to 3306 if omitted.


Usage

import pydbc_mysql  # registers MysqlDriver with DriverManager
from pydbc_core import DriverManager

conn = DriverManager.get_connection("pydbc:mysql://user:password@localhost:3306/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

PyMySQL uses format (%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_mysql-1.0.0.tar.gz (5.4 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_mysql-1.0.0-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: alt_python_pydbc_mysql-1.0.0.tar.gz
  • Upload date:
  • Size: 5.4 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_mysql-1.0.0.tar.gz
Algorithm Hash digest
SHA256 836161b3b41a4b4f0ae4bb5d26671916e2781c8e29c3fb1a90f195fa9f3a5c17
MD5 b4468a38219d95ff7de830910e89d96e
BLAKE2b-256 3d34319cce9e313f7dbaa4bdc458d9cbbfcb2669bbe88b51fb28d77c06ea8817

See more details on using hashes here.

File details

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

File metadata

  • Download URL: alt_python_pydbc_mysql-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.2 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_mysql-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 146c9eeda560bcb71e93e050cd03a8586e7f0eee29ea1f8dae9b7fbbe6e76125
MD5 fe36b6ed1c9fc8da6c7ac0b9e71a6273
BLAKE2b-256 8f345b303294a74fd5ae528a35be3f0f344114eca5216a79858b0c40e356e406

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