Files
Analytical_engine_backend/test_s3.py
2026-05-11 12:36:20 +05:30

19 lines
608 B
Python

import duckdb
def test_s3():
try:
conn = duckdb.connect()
conn.execute("INSTALL httpfs; LOAD httpfs;")
conn.execute("SET s3_region='sgp1';")
conn.execute("SET s3_endpoint='sgp1.digitaloceanspaces.com';")
conn.execute("SET s3_url_style='path';")
# Test if we can see the files
res = conn.execute("SELECT count(*) FROM read_parquet('s3://nearle/parquet/deliveries/*.parquet')").fetchall()
print(f"S3 Count: {res[0][0]}")
except Exception as e:
print(f"Error accessing S3: {e}")
if __name__ == "__main__":
test_s3()