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

Convert Decimal to non native Decimal type

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Duplicate
    • 0.9.55
    • 0.9.56, N/A
    • Generic
    • 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

            georg Georg Richter
            georg Georg Richter
            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.