init
This commit is contained in:
commit
1fd8a68383
10 changed files with 1118 additions and 0 deletions
36
duck.py
Normal file
36
duck.py
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
import duckdb
|
||||
|
||||
create_table = """
|
||||
INSTALL httpfs;
|
||||
LOAD httpfs;
|
||||
SET s3_region='us-east-1';
|
||||
SET s3_url_style='path';
|
||||
SET s3_endpoint='minio.wayl.one';
|
||||
SET s3_use_ssl = true; -- Set to false if your endpoint doesn't use SSL
|
||||
CREATE TABLE bookings AS SELECT * FROM read_csv_auto('s3://duckdb-playground/hotel_bookings.csv', all_varchar=1);
|
||||
"""
|
||||
|
||||
all_sql = """
|
||||
SELECT * FROM bookings;
|
||||
"""
|
||||
|
||||
count_sql = """
|
||||
select count(*) from bookings;
|
||||
"""
|
||||
agg_sql = """
|
||||
SELECT
|
||||
reservation_status,
|
||||
COUNT(*)
|
||||
FROM
|
||||
bookings
|
||||
GROUP BY
|
||||
reservation_status
|
||||
"""
|
||||
|
||||
duckdb.sql(create_table)
|
||||
|
||||
all = duckdb.sql(all_sql)
|
||||
count = duckdb.sql(count_sql)
|
||||
print(count)
|
||||
agg = duckdb.sql(agg_sql)
|
||||
print(agg)
|
||||
Loading…
Add table
Add a link
Reference in a new issue