XMLWordPrintable

Details

    • New Feature
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • None
    • 2.0.0-rc
    • Other
    • None

    Description

      Async Implementation for MariaDB Connector v2

      Summary

      Add native async/await support for non-blocking database operations.

      Implementation Strategy

      Native Python (CONPY-324)

      • Use native asyncio for socket I/O
      • Follow existing pure Python connector implementation

      C/C Extension (requires design)

      • First async implementation in C extension
      • Need to define approach for exposing async to Python
      • Options: GIL release + threads, callback-based, or async C API
      • *Requires separate investigation*

      Core API

      Connection & Queries

      # Connection
      from mariadb import AsyncConnection
       
      # Connect to database
      async with await mariadb.AsyncConnection.connect("mariadb://user:pass@host/db") as conn:
          # Queries
          row = await conn.fetchone("SELECT * FROM users WHERE id = ?", (1,))
          rows = await conn.fetchall("SELECT * FROM users")    
      

      Connection Pool

      pool = await mariadb.AsyncConnectionPool("mariadb://user:pass@host/db", min_size=1, max_size=20)
       
      async with pool.get_connection() as conn:
               with conn.cursor() as cursor:
                       await cursor.execute("SELECT 2")
                       result = await cursor.fetchone()
       
      await pool.close()
      

      Tasks

      1. *Native Python* (builds on CONPY-324)

      • Async socket I/O layer
      • Query execution
      • Result streaming
      • Transaction support

      2. *C Extension* (new work)

      • Investigation: async architecture for C extension
      • Design doc: how to expose async from C to Python
      • Implementation based on design

      Attachments

        Issue Links

          Activity

            People

              diego dupin Diego Dupin
              georg Georg Richter
              Votes:
              5 Vote for this issue
              Watchers:
              10 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.