duckdb / duckdb/duckdb-httpfs

S3Tables: Missing Authentication Token

Open
#35 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
60
Forks
100
Avg merge
1h 50m
Merged PRs (30d)
25

Description

### What happens?

throw token error but doesn't accept session token

### To Reproduce

```
async def execute_query(self, query: str) -> List[Dict[str, Any]]:
"""Execute a query against Iceberg tables"""
try:
# Initialize DuckDB connection
import duckdb
conn = duckdb.connect(':memory:')

# Install and load required extensions
conn.execute("FORCE INSTALL aws FROM core_nightly;")
conn.execute("FORCE INSTALL httpfs FROM core_nightly;")
conn.execute("FORCE INSTALL iceberg FROM core_nightly;")
conn.execute("LOAD aws;")
conn.execute("LOAD httpfs;")
conn.execute("LOAD iceberg;")

# Configure AWS credentials using documented approach
conn.execute(f"""
CREATE SECRET (
TYPE s3,
KEY_ID '{self.credentials["aws_access_key_id"]}',
SECRET '{self.credentials["aws_secret_access_key"]}',
REGION '{self.region}'
);
""")

# Get table bucket ARN
table_bucket_arn = os.environ.get('TABLE_BUCKET_ARN')
if not table_bucket_arn:
raise ValueError("TABLE_BUCKET_ARN environment variable is required")

# Attach to S3 Tables catalog using documented approach
conn.execute(f"""
ATTACH '{table_bucket_arn}' AS s3_tables (
TYPE iceberg,
ENDPOINT_TYPE s3_tables
);
""")

# Extract table name from query
table_name = query.split('FROM iceberg.')[1].split(' ')[0]

# Modify the query to use the attached catalog
modified_query = query.replace('FROM iceberg.', 'FROM s3_tables.default.')

# Execute the query
result = conn.execute(modified_query).fetchdf()

# Convert to list of dictionaries
return result.to_dict('records')
```

### OS:

iOS

### DuckDB Version:

1.2.1

### DuckDB Client:

Python

### Hardware:

_No response_

### Full Name:

Praneeth

### Affiliation:

AWS

### What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have not tested with any build

### Did you include all relevant data sets for reproducing the issue?

No - I cannot share the data sets because they are confidential

### Did you include all code required to reproduce the issue?

- [x] Yes, I have

### Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?

- [x] Yes, I have

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.