duckdb_aws icon indicating copy to clipboard operation
duckdb_aws copied to clipboard

Should the `aws` plugin be loaded explicitly?

Open mriccia opened this issue 10 months ago • 1 comments
trafficstars

I am writing some code to use DuckDB to query data residing in a S3 Bucket.

According to the docs:

you will not need to explicitly interact with the aws extension. It will automatically be invoked whenever you use DuckDB's [S3 Secret functionality](https://duckdb.org/docs/sql/statements/create_secret.html).

However, if I don't explicitly install and load the aws plugin, the following code fails:

# Prepare DuckDB
conn = duckdb.connect()
conn.execute('SET home_directory="/tmp/duckdb/";')
# conn.execute("INSTALL aws;")
# conn.execute("LOAD aws;")
conn.execute("INSTALL httpfs;")
conn.execute("LOAD httpfs;")
conn.execute('''
CREATE SECRET secret1 (
    TYPE S3,
    PROVIDER CREDENTIAL_CHAIN
);
''')

Observed error:

[ERROR] Error: An error occurred while trying to automatically install the required extension 'aws':
Can't find the home directory at ''
Specify a home directory using the SET home_directory='/path/to/dir' option.

I created a small example that can be used to test this, please find it in this repo: https://github.com/mriccia/duckdb-lambda-example

Should the aws plugin be loaded explicitly?

mriccia avatar Jan 06 '25 15:01 mriccia

Thanks for reporting @mriccia! Autoloading doesn't seem to respect the home_directory here. Since the INSTALL + LOAD path does respect the home directory here, it does work. As a workaround explicit installation will be required for now.

This is something we should look into fixing.

samansmink avatar Jan 06 '25 16:01 samansmink