-- write a table to the bucket as Parquet
COPY (SELECT * FROM events) TO 's3://my-bucket/events.parquet';
-- read it back, with a filter
SELECT count(*) FROM read_parquet('s3://my-bucket/events.parquet') WHERE event_type = 'upload';
-- glob over many files
SELECT * FROM read_parquet('s3://my-bucket/events/*.parquet');
-- CSV and JSON work the same way
SELECT * FROM read_csv('s3://my-bucket/reports/sales.csv', header = true);
SELECT * FROM read_json_auto('s3://my-bucket/logs/*.json');
-- partitioned output and reads
COPY (SELECT * FROM events) TO 's3://my-bucket/by-day' (FORMAT parquet, PARTITION_BY (day));
SELECT count(*) FROM read_parquet('s3://my-bucket/by-day/*/*.parquet', hive_partitioning = true);
-- list what is there
SELECT * FROM glob('s3://my-bucket/**');