DuckDB connecting to OCI bucket

115 views Asked by At

can i connect and read files from OCI bucket using duckdb? i have tried to follow their documentation but i'm not sure if OCI is supported.

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}" 

i keep getting this error: Error: Invalid Error: Unable to connect to URL

1

There are 1 answers

0
Gabor Szarnyas On

OCI buckets offer an S3 compatibility API, so DuckDB should be able to read from them.

Try the following steps:

  1. Set the s3_endpoint to <your_bucket_namespace>.compat.objectstorage.<your_region>.oraclecloud.com
  2. Set the s3_url_style to path
  3. Then, try reading from s3://<your_bucket_name>/<file_path>