Details

    • Task
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • N/A
    • 1.0.3
    • Generic
    • None

    Description

      Provide a converter to convert values into another format, e.g. datetime.timedelta to datetime.time:

      import mariadb
      from mariadb.constants import CLIENT, FIELD_TYPE
      import datetime
       
      def timedelta_to_time(s):
          return (datetime.datetime.min + s).time()
       
      conversions = {
          **{FIELD_TYPE.TIME: timedelta_to_time}
      }
       
      conn= mariadb.connect(db="test", converter=conversions)
      cursor=conn.cursor()
      cursor.execute("SELECT CAST(NOW() AS TIME)")
      row= cursor.fetchone()
      print(row)
      del cursor, conn
      

      Instead of datetime.timedelta result will be datetime.time

      Attachments

        Activity

          georg Georg Richter created issue -
          georg Georg Richter made changes -
          Field Original Value New Value
          issue.field.resolutiondate 2020-10-04 10:21:49.0 2020-10-04 10:21:49.902
          georg Georg Richter made changes -
          Component/s Generic [ 14515 ]
          Resolution Fixed [ 1 ]
          Status Open [ 1 ] Closed [ 6 ]
          serg Sergei Golubchik made changes -
          Workflow MariaDB v3 [ 113987 ] MariaDB v4 [ 128643 ]

          People

            georg Georg Richter
            georg Georg Richter
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.