{"id":24377,"library":"pypyodbc","title":"pypyodbc","description":"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.","status":"active","version":"1.3.6","language":"python","source_language":"en","source_url":"https://github.com/pypyodbc/pypyodbc","tags":["odbc","database","pure-python","windows","linux","macos"],"install":[{"cmd":"pip install pypyodbc","lang":"bash","label":"PyPI"}],"dependencies":[],"imports":[{"note":"No common mistake; just import the module.","wrong":"","symbol":"pypyodbc","correct":"import pypyodbc"},{"note":"Direct import from pypyodbc works.","wrong":"","symbol":"DatabaseError","correct":"from pypyodbc import DatabaseError"}],"quickstart":{"code":"import pypyodbc\n\n# Replace with your actual DSN or connection string\nconnection = pypyodbc.connect('DSN=my_dsn;UID=user;PWD=password')\ncursor = connection.cursor()\ncursor.execute(\"SELECT 'Hello, World!' AS greeting\")\nfor row in cursor.fetchall():\n    print(row['greeting'])\ncursor.close()\nconnection.close()","lang":"python","description":"Simple connection and query using a DSN."},"warnings":[{"fix":"Always call pypyodbc.connect() not pyodbc.connect().","message":"pypyodbc does not use pyodbc's function names like 'connect' directly on module level; you must use pypyodbc.connect().","severity":"gotcha","affected_versions":"all"},{"fix":"Use proper ODBC connection strings; see documentation.","message":"Connection strings must be formatted for ODBC, not for native database drivers. For example, SQL Server requires 'DRIVER={ODBC Driver 17 for SQL Server};SERVER=...'.","severity":"gotcha","affected_versions":"all"},{"fix":"Install unixODBC and driver (e.g., freetds, msodbcsql17).","message":"On macOS/Linux, you need to install unixODBC and appropriate ODBC drivers. pypyodbc itself is pure Python but ODBC driver layer is not.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install ODBC driver (e.g., msodbcsql17) and configure DSN or use full connection string.","cause":"ODBC driver not installed or DSN not configured.","error":"Error: ('IM002', '[IM002] [unixODBC][Driver Manager]Data source name not found, and no default driver specified')"},{"fix":"Check connection string format: 'DRIVER={...};SERVER=...;DATABASE=...;UID=...;PWD=...'.","cause":"Connection string syntax error, often missing semicolon or incorrect attribute.","error":"pypyodbc.DatabaseError: ('HY024', '[HY024] [Microsoft][ODBC Driver 17 for SQL Server]Invalid connection string attribute (0) (SQLDriverConnect)')"},{"fix":"Run 'pip install pypyodbc'.","cause":"pypyodbc not installed.","error":"ModuleNotFoundError: No module named 'pypyodbc'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}