我一直在尝试查询aws athena,并做了足够的工作来获取我的数据。但是我的数据需要识别一些模式并以统一的方式进行更改,以便将这些“相似之处”归为一组。因此,我正在尝试制作regex_replacement,但是如何对同一列中的同一列进行多次替换?
这是我的查询:
with q as (SELECT r.key,
r.otherid,
r.complexString,
minute(date_trunc('minute', from_iso8601_timestamp(r.time) AT TIME ZONE 'America/New_York')) AS minute,
hour(from_iso8601_timestamp(r.time) AT TIME ZONE 'America/New_York') AS hour,
day(from_iso8601_timestamp(r.time) AT TIME ZONE 'America/New_York') AS day
FROM requests0918 t
JOIN requests0918 t1 ON t.id = t1.id
WHERE t1.msg = 'response_written' AND t1.code = '200'
and t.otherid is not null
and t.key is not null
and t.path is not null
limit 10)
Select q.key, q.otherid, REGEXP_REPLACE(q.complexString, '\/accounts\/[0-9]+\/balances', '/accounts/.../balances' ) as path, q.minute, q.hour, q.day from q
因此我成功地将此字符串更改为该字符串。但是我需要设置更多模式并在相同的列名称下进行替换。
所以我正在寻找如何做。我可以添加更多with q as {Query}
层来添加更多规则,但这听起来很错误。
因此,我在这里从最好的社区寻求帮助:P
预先感谢!