xresch / EngineeredMonitoringPlatform

8 stars 1 forks source link

TIMESTAMP column yields JSON from Oracle (instead of Unix epoch milliseconds) #3

Open bittner opened 3 weeks ago

bittner commented 3 weeks ago

When you create a dashboard to display content of a table with a TIMESTAMP column in your Oracle database, EMP returns JSON code from the database. Unfortunately, EMP can't render those values as the widgets on the frontend appear to expect Unix epoch time milliseconds.

Problem Example

| source oracle
    environment=...
    query=`SELECT BUSINESS_DATE, CREATED_TIMESTAMP FROM FOO`

yields, e.g.

BUSINESS_DATE    CREATED_TIMESTAMP
1729641600000    {"data":[120, 124, 10, 25, 9, 9, 32, 7, 38, -72, 16], "targetDatum":null, "ojiOracleDatumWithConnection":null}
1727049600000    {"data":[120, 124, 10, 24, 8, 33, 31, 16, -59, 89, -88], "targetDatum":null, "ojiOracleDatumWithConnection":null}

Current Workaround

We can, of course, convert the timestamp to Unix epoch time millis, but that's tedious (and brings its own set of problems), e.g.

| source oracle
    environment=...
    query=`SELECT BUSINESS_DATE, (CAST(CREATED_TIMESTAMP AS DATE)-TO_DATE('01-JAN-70'))*24*60*60*1000 AS EPOCH_CREATED FROM FOO`

yields, e.g.

BUSINESS_DATE    EPOCH_CREATED
1729641600000    1729843711000
1727049600000    1729755150000

Expected Behavior

EMP should yield Unix epoch time milliseconds for TIMESTAMP fields just like it does for DATE fields.

xresch commented 3 weeks ago

Hi @bittner,

thanks for the report. Can you tell me what data type is specified in the column definition of "CREATED_TIMESTAMP"?

Thanks and Regards Reto

bittner commented 3 weeks ago

Can you tell me what data type is specified in the column definition of "CREATED_TIMESTAMP"?

On the Oracle database, the data type is TIMESTAMP(6).