DuckDB 连接到 OCI 存储桶

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

我可以使用 duckdb 连接 OCI 存储桶并读取文件吗?我尝试遵循他们的文档,但我不确定是否支持 OCI。

import duckdb
cursor = duckdb.connect()
cursor.execute("INSTALL httpfs;")
cursor.execute("LOAD httpfs;")
cursor.execute(f"SET s3_endpoint='{ENDPOINT}'")
cursor.execute(f"SET s3_region='{region_name}'")
cursor.execute(f"SET s3_access_key_id='{ACCESS_KEY}'")

cursor.execute(f"SET s3_secret_access_key='{SECRET_KEY}'")
cursor.execute("PRAGMA enable_profiling;")

s3_path = https://<your_bucket_namespace>.compat.objectstorage.<your_region>.oraclecloud.com/<your_bucket_name>/<file_path>

t = "SELECT count(*) FROM read_parquet('{s3_path}" 

我不断收到此错误:错误:无效错误:无法连接到 URL

python bucket oracle-cloud-infrastructure duckdb
1个回答
0
投票

OCI 存储桶提供 S3 兼容性 API,因此 DuckDB 应该能够从中读取数据。

尝试以下步骤:

  1. s3_endpoint
    设置为
    <your_bucket_namespace>.compat.objectstorage.<your_region>.oraclecloud.com
  2. s3_url_style
    设置为
    path
  3. 然后,尝试阅读
    s3://<your_bucket_name>/<file_path>
© www.soinside.com 2019 - 2024. All rights reserved.