K
K
Kylo_Ren_Knight2021-10-08 18:08:07
SQL
Kylo_Ren_Knight, 2021-10-08 18:08:07

How to parse Vertica json into columns?

Please tell me how I can split the information that is stored in the column into columns.
It is stored as JSON, base on Vertica

I have a query
SELECT
cfv.textvalue
FROM prodjiradb.jiraissue ji
left join prodjiradb.project jp on ji.project = jp.id
left join prodjiradb.customfieldvalue cfv on ji.id = cfv.issue

It outputs 1 column with data in JSON format

The data looks like this:
{"timeline":{"events":[{"date":1632049390369,"types":["START"]},{"date":1632049410740,"types":["PAUSE"]},{"date ":1632060783640,"types":["UNPAUSE"]},{"date":1632063914475,"types":["PAUSE"]},{"date":1632754847349,"types":["UNPAUSE"]} ,{"date":1632834239820,"types":["STOP"]}]},"ongoingSLAData":null,"completeSLAData":[{"succeeded":true,"goalTime":259200000,"goalTimeUnits":{ "weeks":0,"remainingDaysWithinWeek":2,"remainingMillisWithinDay":86400000,"breached":false},"elapsedTime":82543677,"remainingTime":176656323,"remainingTimeInDaysAndMillis":{"weeks":0,"remainingDaysWithinWeek":1,"remainingMillisWithinDay":90256323,"breached":false},"calendarName":"Default 24/7 calendar","startTime":1632049390369,"stopTime" :1632834239820}],"metricId":356,"definitionChangeDate":1630592666287,"definitionChangeMsEpoch":1630592666287,"goalsChangeDate":null,"goalsChangeMsEpoch":null,"goalTimeUpdatedDate":nullatemetric"Cated :1630592666103,"updatedDate":1632864315870}startTime":1632049390369,"stopTime":1632834239820}],"metricId":356,"definitionChangeDate":1630592666287,"definitionChangeMsEpoch":1630592666287,"goalsChangeDate":null,"goalsChangenulled:Upochnullated"Time"Date" goalTimeUpdatedMsEpoch":null,"metricCreatedDate":1630592666103,"updatedDate":1632864315870}startTime":1632049390369,"stopTime":1632834239820}],"metricId":356,"definitionChangeDate":1630592666287,"definitionChangeMsEpoch":1630592666287,"goalsChangeDate":null,"goalsChangenulled:Upochnullated"Time"Date" goalTimeUpdatedMsEpoch":null,"metricCreatedDate":1630592666103,"updatedDate":1632864315870}

I need to parse it into columns with data in the same query.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lazy @BojackHorseman, 2021-10-08
SQL

on the client obviously.
the engine is not to blame for the serialized string in the field

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question