6 Replies Latest reply on Dec 2, 2019 4:05 AM by Jan Finis

    Hyper API 0.0.8707: time fields from csv do not export correcty to extract

    Patryk Grabowski

      Hi all,

      I have with issue with Hyper Api, where the dates from time fields aren't copied from csv to the extract correctly. Whatever the date is in the field the result is always '30.12.1899 hh:mm:ss'

       

      whatisthis.png

      Definition of my table is:

       

      history_table = TableDefinition(
         name=TableName(prtg_schema, "history"),
         columns=[

        TableDefinition.Column(name='DateTime', type=SqlType.time(), nullability=NULLABLE),
         TableDefinition.Column(name='SensorId', type=SqlType.big_int(), nullability=NULLABLE),
         TableDefinition.Column(name='PingTime', type=SqlType.double(), nullability=NULLABLE),
         TableDefinition.Column(name='Minimum', type=SqlType.double(), nullability=NULLABLE),
         TableDefinition.Column(name='Maximum', type=SqlType.double(), nullability=NULLABLE),
         TableDefinition.Column(name='PacketLoss', type=SqlType.double(), nullability=NULLABLE),
         TableDefinition.Column(name='Coverage', type=SqlType.double(), nullability=NULLABLE)

        ]

      )

       

      And to copy from cvs I'm doing:

       

      connection.execute_command(

         command=f"COPY {history_table.table_name} from {escape_string_literal(path_to_history_csv)}  with "
        f"(format csv, NULL '', delimiter ';', header, quote '\"', escape '\\')")

       

      When I open same csv(which I attached) in Tableau desktop it's fine:

      thisgood.png

       

      Looks like a bug. Is there a way to get around that?

       

      Best regards

      Patryk