提问人:Danial 提问时间:10/29/2023 最后编辑:Gabor SzarnyasDanial 更新时间:11/20/2023 访问量:52
DuckDB 连接到 OCI 存储桶
DuckDB connecting to OCI bucket
问:
是否可以使用 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
答:
0赞
Gabor Szarnyas
11/2/2023
#1
OCI 存储桶提供 S3 兼容性 API,因此 DuckDB 应该能够从中读取数据。
请尝试以下步骤:
- 将
s3_endpoint
<your_bucket_namespace>.compat.objectstorage.<your_region>.oraclecloud.com
- 将
s3_url_style
path
- 然后,尝试阅读
s3://<your_bucket_name>/<file_path>
评论