Uploaded image for project: 'MariaDB Connector/Python'
  1. MariaDB Connector/Python
  2. CONPY-325

Add Type Hints to MariaDB Python Connector

    XMLWordPrintable

Details

    • Task
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • None
    • 2.0.0-rc
    • Other
    • 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()
      

      Attachments

        Activity

          People

            diego dupin Diego Dupin
            diego dupin Diego Dupin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.