I am trying to do Json Flattening using MSSQL table where I have stored some Json data as Key-Value format, but I think dremio doesn’t have any functionality to do direct flattening from the table based on key.
I am sharing a screenshot of my stored table data.
you are confusing, this is not flattern
FLATTEN separates the elements in a repeated field into individual records
if you want some as
| keyname | productionDay | entityName | entityType |
you must access direct
select keyname, data.productionDay, data.entityName, data.entityType
from CurationTest
Sorry, this is because your CurationTest is NOT a JSON file.
What type is your source of CurationTest?
so try
select keyname, x.data.productionDay as productionDay, x.data.entityName, x.data.entityType
from (
SELECT keyname, convert_from(data, 'JSON') AS data
FROM CurationTest
) as x