Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
-
None
Description
Add comprehensive type annotations for static type checking and improved IDE support.
- Enable mypy/pyright type checking
- Better IDE autocomplete
- Catch type errors at development time
- Required for v2 async API
API Examples
Connection
conn: mariadb.Connection = mariadb.connect( |
host: str = "localhost", |
port: int = 3306, |
user: str = "root", |
password: str = "secret", |
database: str | None = None |
)
|
Query execution
cursor: mariadb.Cursor = conn.cursor() |
cursor.execute("SELECT * FROM users WHERE id = ?", (1,)) |
row: tuple | None = cursor.fetchone() |
rows: list[tuple] = cursor.fetchall() |