【问题标题】:How to skip errors when using json_extract_path_text in Redshift?在 Redshift 中使用 json_extract_path_text 时如何跳过错误?
【发布时间】:2018-02-02 20:51:02
【问题描述】:

我有以下查询:

SELECT 'curl -s http://www.mde.operator.com/MRE/api?profile=CANCEL_AUTH&mode=assync-oneway&Auth='||json_extract_path_text(external_reference_id,'transactionIdAuth') + '&NUM=' + phone  FROM dbo.cancelled WHERE id like '%Auth%';

它会带来超过 6 万个结果,但是 json 被破坏了,我无法设法删除断线。

有什么方法可以跳过显示任何错误的行吗?

注意:它不是空行。

我已经试过了:

json_extract_path_text(regexp_replace(event_properties,'\\\\.',''),'someValue')

【问题讨论】:

  • 你好,谁能给我关于这个问题的线索?

标签: sql arrays json linux amazon-redshift


【解决方案1】:

您可以通过将json_extract_path_text 函数的null_if_invalid 参数设置为true 来使它们为空行。

来源:https://docs.aws.amazon.com/redshift/latest/dg/JSON_EXTRACT_PATH_TEXT.html

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-10-08
    • 2023-01-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多