Uploaded image for project: 'MariaDB ColumnStore'
  1. MariaDB ColumnStore
  2. MCOL-1973

A `time` datatype is interpreted in Python as datetime.timedelta

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Not a Bug
    • None
    • Icebox
    • MariaDB Server
    • None

    Description

      Following is ColumnStore table structure containing time field of type datatype:
      MariaDB [tradealert]> desc onelots;
      ----------------------------------------+

      Field Type Null Key Default Extra

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

      trade_id int(11) YES   NULL  
      secid int(11) YES   NULL  
      side tinyint(4) YES   NULL  
      size int(11) YES   NULL  
      price float YES   NULL  
      exch char(1) YES   NULL  
      time time YES   NULL  
      date date YES   NULL  
      bexch char(1) YES   NULL  
      aexch char(1) YES   NULL  
      bid float YES   NULL  
      ask float YES   NULL  
      bsize smallint(6) YES   NULL  
      asize smallint(6) YES   NULL  
      spot float YES   NULL  
      spot_chg float YES   NULL  
      volume int(11) YES   NULL  
      open_int int(11) YES   NULL  
      cond char(1) YES   NULL  
      root char(8) YES   NULL  
      delta float YES   NULL  
      ivol float YES   NULL  
      ivol_chg float YES   NULL  
      usymbol char(6) YES   NULL  
      expiry date YES   NULL  
      put_call char(1) YES   NULL  
      strike float YES   NULL  
      vega float YES   NULL  
      theta float YES   NULL  
      theo float YES   NULL  
      nonstd tinyint(4) YES   NULL  

      ----------------------------------------+
      31 rows in set (0.001 sec)

      When running following query from Python the resultset returned is rendeting time field for each record returned as datetime.timedelta.

      query = "SELECT sio.`id` AS option_id, o.`date` AS market_date, o.`time`, o.`size`, o.`price`, o.`spot`, "\
      "o.open_int, o.theo, o.ivol, o.delta, o.vega, o.theta, o.`secid` "\
      "FROM onelots AS o LEFT JOIN securities_occ AS so ON o.secid = so.secid "\
      "LEFT JOIN dds_main.`sec_instrument_option` AS sio ON so.`occ_identifier` = sio.`occ_identifier` "\
      "WHERE o.date = '2018-01-02' LIMIT 10"

      I am not sure where is the problem but I would say that Python driver does not recognize time datatype and wrongly interprets it.

      Attachments

        Activity

          People

            LinuxJedi Andrew Hutchings (Inactive)
            madamec Martin Adamec
            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.