🗂

SYSTEM$ALLOWLIST() & SYSTEM$ALLOWLIST_PRIVATELINK()

2024/04/25に公開

Tableau→Snowflakeの接続で、許可ドメインを調べるための方法

https://community.snowflake.com/s/article/CURLerror-SSL-peer-certificate-or-SSH-remote-key-was-not-OK-during

に記載がありました。
意外に色々許可しないと繋がらないのかもしれませんね(特に会社のイントラネットなどから接続する場合に、下記をProxyの許可リストに登録しなければならないっぽい)

select SYSTEM$ALLOWLIST();
select SYSTEM$ALLOWLIST_PRIVATELINK();

を叩けばいいのですが、JSON形式で出力されるため、めんどくさい・・・・
ってわけで、整形するSQLを書いたのでメモ

------ SYSTEM$ALLOWLIST() & SYSTEM$ALLOWLIST_PRIVATELINK();
with source_allowlist as (
    select 
        parse_json(system$allowlist()) as url
), parse_allowlist as (
select 
    var.value:host::string as host
    , var.value:port::string as port
    , var.value:type::string as type
from
    source_allowlist
    , lateral flatten(input => url) var
)
, source_allowlist_privatelink as (
    select 
        parse_json(system$allowlist()) as url
), parse_allowlist_privatelink as (
select 
    var.value:host::string as host
    , var.value:port::string as port
    , var.value:type::string as type
from
    source_allowlist_privatelink
    , lateral flatten(input => url) var
)
, final as(
    select * from parse_allowlist
    union
    select * from parse_allowlist_privatelink
)
select * from final;

;

unionはsource_allowlist_privatelinkとsource_allowlistを先にやるべきかもしれない・・・・orz

Discussion