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

Error with numeric values returned from query.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Not a Bug
    • Affects Version/s: 1.0.0
    • Fix Version/s: N/A
    • Component/s: Generic
    • Labels:
      None

      Description

      Mac OS X 10.15.5
      Brew installed: python@3.8 and mariadb-connector-c
      pip installed mariadb connector version 1.0.0

      Python Version:
      (Python 3.8.3 (default, Jul 8 2020, 14:27:55)
      [Clang 11.0.3 (clang-1103.0.32.62)] on darwin
      Type "help", "copyright", "credits" or "license" for more information.)

      In DB data looks like:
      mysql> SELECT date, time, id, value FROM odczyty WHERE date = '2020-07-16' ORDER BY seq_no DESC LIMIT 10;
      -----------------------------------------+

      date time id value

      -----------------------------------------+

      2020-07-16 18:05:01 28-0116231917ee 17.875
      2020-07-16 18:05:01 28-02161fc3e5ee 17.937
      2020-07-16 18:05:01 28-01162336c8ee 17.875
      2020-07-16 18:00:01 28-0116231917ee 17.875
      2020-07-16 18:00:01 28-02161fc3e5ee 17.937
      2020-07-16 18:00:01 28-01162336c8ee 17.937
      2020-07-16 17:55:01 28-0116231917ee 17.875
      2020-07-16 17:55:01 28-02161fc3e5ee 17.937
      2020-07-16 17:55:01 28-01162336c8ee 17.875
      2020-07-16 17:50:01 28-0116231917ee 17.875

      -----------------------------------------+
      10 rows in set (0.01 sec)

      In script
      cur.execute("SELECT date, time, id, value FROM odczyty WHERE date=? ORDER BY seq_no DESC LIMIT 10", (today,) )

      returns values like:
      Date: 2020-07-16 17:55:01 | id: 28-0116231917ee | value: 17.875
      Date: 2020-07-16 17:55:01 | id: 28-02161fc3e5ee | value: 17.937000274658203
      Date: 2020-07-16 17:55:01 | id: 28-01162336c8ee | value: 17.875
      Date: 2020-07-16 17:50:01 | id: 28-0116231917ee | value: 17.875
      Date: 2020-07-16 17:50:01 | id: 28-02161fc3e5ee | value: 17.937000274658203
      Date: 2020-07-16 17:50:01 | id: 28-01162336c8ee | value: 17.875
      Date: 2020-07-16 17:45:01 | id: 28-0116231917ee | value: 17.875
      Date: 2020-07-16 17:45:01 | id: 28-02161fc3e5ee | value: 17.937000274658203
      Date: 2020-07-16 17:45:01 | id: 28-01162336c8ee | value: 17.875
      Date: 2020-07-16 17:40:01 | id: 28-0116231917ee | value: 17.875

      but when run like this:
      cur.execute("SELECT date, time, id, value FROM odczyty WHERE date='2020-07-16' ORDER BY seq_no DESC LIMIT 10")

      returns proper values:
      Date: 2020-07-16 17:55:01 | id: 28-0116231917ee | value: 17.875
      Date: 2020-07-16 17:55:01 | id: 28-02161fc3e5ee | value: 17.937
      Date: 2020-07-16 17:55:01 | id: 28-01162336c8ee | value: 17.875
      Date: 2020-07-16 17:50:01 | id: 28-0116231917ee | value: 17.875
      Date: 2020-07-16 17:50:01 |t id: 28-02161fc3e5ee | value: 17.937
      Date: 2020-07-16 17:50:01 | id: 28-01162336c8ee | value: 17.875
      Date: 2020-07-16 17:45:01 | id: 28-0116231917ee | value: 17.875
      Date: 2020-07-16 17:45:01 | id: 28-02161fc3e5ee | value: 17.937
      Date: 2020-07-16 17:45:01 | id: 28-01162336c8ee | value: 17.875
      Date: 2020-07-16 17:40:01 | id: 28-0116231917ee | value: 17.875

      Server is MariaDB 10 on Synology.
      I've attached DB dump and python test script.

        Attachments

        1. termik.sql
          176 kB
        2. test.py
          1 kB

          Activity

            People

            Assignee:
            georg Georg Richter
            Reporter:
            michalsarna Michal Sarna
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Git Integration