httpx.ConnectError: [Errno 16] 设备或资源在雪花函数调用中繁忙

问题描述 投票:0回答:1

我正在尝试使用

google translate
python 存储过程调用
snowflake
python 代码。调用该函数时,我收到错误如下

 File "/home/udf/83428393/httpcore.zip/httpcore/_exceptions.py", line 14, in map_exceptions
    raise to_exc(exc) from exc
httpcore.ConnectError: [Errno 16] Device or resource busy

上述异常是导致以下异常的直接原因:

Traceback (most recent call last):
  File "/usr/lib/python_udf/f8ec62c410e9e3922c786641658c8c13d2fb99db0751b02297123925d6bd4997/lib/python3.10/site-packages/httpx/_transports/default.py", line 84, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.ConnectError: [Errno 16] Device or resource busy

我正在使用

httpx 0.26.1
版本。请推荐。

python stored-procedures snowflake-cloud-data-platform
1个回答
0
投票

我相信您需要在 Snowflake 中创建外部访问集成。 请参阅Snowflake 文档中的所有详细信息。

本质上:

  1. 创建代表凭证的秘密
CREATE OR REPLACE SECRET oauth_token
TYPE = OAUTH2
API_AUTHENTICATION = google_translate_oauth
OAUTH_REFRESH_TOKEN = 'my-refresh-token';
  1. 创建代表外部网络位置的网络规则
CREATE OR REPLACE NETWORK RULE google_apis_network_rule
MODE = EGRESS
TYPE = HOST_PORT
VALUE_LIST = ('translation.googleapis.com');
  1. 使用秘密和网络规则创建外部访问集成
USE ROLE ACCOUNTADMIN;
CREATE OR REPLACE EXTERNAL ACCESS INTEGRATION google_apis_access_integration
ALLOWED_NETWORK_RULES = (google_apis_network_rule)
ALLOWED_AUTHENTICATION_SECRETS = (oauth_token)
ENABLED = true;
  1. 在过程定义中,添加
    EXTERNAL_ACCESS_INTEGRATIONS = (google_apis_access_integration)
    SECRETS = ('cred' = oauth_token )
© www.soinside.com 2019 - 2024. All rights reserved.