[英]Extract value from a super field
I have a field event_params
that is type super
.我有一个类型为super
的字段event_params
。
Example value of event_params: event_params 的示例值:
[
{"key":"type","value":{"string_value":"blah"}},
{"key":"value","value":{"double_value":5.99}},
{"key":"category","value":{"string_value":"add-ons"}},
{"key":"event_id","value":{"string_value":"956bb654-be90-5334-91a3-ee97074da0eb"}},
]
I would like to get event_id without unfolding the whole thing, I just want to drill down into it and pull up event id.我想在不展开整个事情的情况下获得 event_id,我只想深入了解它并提取事件 ID。
Afterreading docs and messing around, I can d0 this: 阅读文档并弄乱之后,我可以这样做:
select
event_params[4].value,
event_params[4].key,
event_params
from "myschema"."mytable"
where event_name = 'purchase'
and event_timestamp = 1660193632449615;
Here I used indexing with 4. But data will not necessarily be in the same order.这里我使用了 4 的索引。但是数据不一定是相同的顺序。 INstead I want to filter based on the key
being event_id
.相反,我想根据作为event_id
的key
进行过滤。
How can I modify this: event_params[4].key
to instead filter based on the name of the key I want, in this case event_id
?我该如何修改: event_params[4].key
以根据我想要的键的名称进行过滤,在本例中为event_id
?
You can try something like this:你可以尝试这样的事情:
select
event_name,
ep
from
"myschema"."mytable" m,
m.event_params as ep
where
event_name = 'purchase'
and event_timestamp = 1660193632449615
and ep.key = 'event_id';
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.