Registry / database / pypyodbc

pypyodbc

JSON →
library1.3.6pypypi✓ verified 87d ago

A pure Python ctypes-based ODBC module supporting multiple databases (SQL Server, Oracle, MySQL, PostgreSQL, SQLite, etc.). Current version 1.3.6 (2022-08-29). Release cadence is sporadic; last release fixed metadata issues from 1.3.5.

pip install pypyodbc
INSTALL
IMPORT
SIG · PYPYODBC
P
pypyodbc
databasepythonv1.3.6
Install
2.7s avg
Import
—
Disk
20MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v1.3.6 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 19.3MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 2.7s · import 0.000s · 20MB
20MB installed
● package 20MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

pypyodbc
✓ import pypyodbc
No common mistake; just import the module.
DatabaseError
✓ from pypyodbc import DatabaseError
Direct import from pypyodbc works.

Simple connection and query using a DSN.

import pypyodbc # Replace with your actual DSN or connection string connection = pypyodbc.connect('DSN=my_dsn;UID=user;PWD=password') cursor = connection.cursor() cursor.execute("SELECT 'Hello, World!' AS greeting") for row in cursor.fetchall(): print(row['greeting']) cursor.close() connection.close()
Debug
Known issues
gotchapypyodbc does not use pyodbc's function names like 'connect' directly on module level; you must use pypyodbc.connect().
fix
Always call pypyodbc.connect() not pyodbc.connect().
affects: all
gotchaConnection strings must be formatted for ODBC, not for native database drivers. For example, SQL Server requires 'DRIVER={ODBC Driver 17 for SQL Server};SERVER=...'.
fix
Use proper ODBC connection strings; see documentation.
affects: all
gotchaOn macOS/Linux, you need to install unixODBC and appropriate ODBC drivers. pypyodbc itself is pure Python but ODBC driver layer is not.
fix
Install unixODBC and driver (e.g., freetds, msodbcsql17).
affects: all
Errors
Common errors & fixes
Error: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not found, and no default driver specified')
ODBC driver not installed or DSN not configured.
fix
Install ODBC driver (e.g., msodbcsql17) and configure DSN or use full connection string.
pypyodbc.DatabaseError: ('HY024', '[HY024] [Microsoft][ODBC Driver 17 for SQL Server]Invalid connection string attribute (0) (SQLDriverConnect)')
Connection string syntax error, often missing semicolon or incorrect attribute.
fix
Check connection string format: 'DRIVER={...};SERVER=...;DATABASE=...;UID=...;PWD=...'.
ModuleNotFoundError: No module named 'pypyodbc'
pypyodbc not installed.
fix
Run 'pip install pypyodbc'.
Upgrade
Version history
1.3.6latest on PyPI · released Dec 23, 2021
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
10
Resources
pypyodbc — pip install pypyodbc · libregistry