Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persistent S3 secret not used in new connection #83

Open
jorritsandbrink opened this issue Nov 24, 2024 · 0 comments
Open

Persistent S3 secret not used in new connection #83

jorritsandbrink opened this issue Nov 24, 2024 · 0 comments

Comments

@jorritsandbrink
Copy link

I'm facing this error when trying to iceberg_scan an Iceberg metadata file on S3 using a persistent secret:

duckdb.duckdb.IOException: IO Error: Cannot open file "s3://my-bucket/my_iceberg_table/metadata/00003-51b3e065-bde2-4d06-af88-ffd14cc8e738.metadata.json": No such file or directory

Reproduce:

import duckdb


duckdb_path = "duck.db"
iceberg_path = "s3://my-bucket/my_iceberg_table/metadata/00003-51b3e065-bde2-4d06-af88-ffd14cc8e738.metadata.json"

conn = duckdb.connect(duckdb_path)
conn.sql("""
CREATE PERSISTENT SECRET my_secret (
    TYPE S3,
    KEY_ID 'my_key_id',
    SECRET 'my_secret',
    REGION 'eu-central-1'
);
""")
conn.close()

conn = duckdb.connect(duckdb_path)
conn.sql("INSTALL iceberg; LOAD iceberg;")
# workaround: uncommenting one of the two lines below makes it work
# conn.sql(f"FROM which_secret('{iceberg_path}', 's3');").show()
# conn.sql("FROM duckdb_secrets();").show()
conn.sql(f"FROM iceberg_scan('{iceberg_path}')").show()

Result:

Traceback (most recent call last):
  File "mre.py", line 23, in <module>
    conn.sql(f"FROM iceberg_scan('{iceberg_path}')").show()
duckdb.duckdb.IOException: IO Error: Cannot open file "s3://my-bucket/my_iceberg_table/metadata/00003-51b3e065-bde2-4d06-af88-ffd14cc8e738.metadata.json": No such file or directory

I've found that, as a workaround, the error can be prevented by executing

conn.sql("FROM duckdb_secrets();").show()

or

conn.sql(f"FROM which_secret('{iceberg_path}', 's3');").show()

before running iceberg_scan.

This seems to only be an issue with iceberg_scan. The error does not occur with delta_scan or read_parquet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant