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

Convert Decimal to non native Decimal type

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Duplicate
    • Affects Version/s: 0.9.55
    • Fix Version/s: N/A, 0.9.56
    • Component/s: Generic
    • Labels:
      None

      Description

      In current implemenation of MariaDB Connector/C MYSQL_TYPE_NEWDECIMAL is converted into a string in both text and binary protocol.

      For compatibility reasons it should be converted to (non native) Decimal type, which will require an additional import of the decimal module.

      How to repeat:

      MariaDB [testp] CREATE TEMPORARY TABLE t1 (a decimal 10,2);
      MariaDB [testp] INSERT INTO t1 VALUES(27);
      
      

      Python:

      conn= mariadb.connect(user="georg")
      cursor=conn.cusor()
      cursor.execute("SELECT a FROM t1")
      cursor.fetchone()
      

      Output:

      MariaDB Connector/Python: '27.00'
      other PEP-249 modules: Decimal('27.00')
      
      

      The example above only shows Decimal usage in result set, it needs to be supported also in parameters for execute() and executemany()

        Attachments

          Activity

            People

            Assignee:
            georg Georg Richter
            Reporter:
            georg Georg Richter
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Git Integration