duckdb-r
duckdb-r copied to clipboard
progress bar does not work
When enabling progress bar
configuration option + enable_progress_bar_print
, R does not show progress bar. Python version of duckdb client does show the progress. Below is code for both R and Python where I make sure the progress bar is enabled, but it only has visible effect in Python, not in R.
R
library(duckdb)
con <- dbConnect(duckdb::duckdb())
dbExecute(con, "INSTALL spatial;")
dbExecute(con, "LOAD spatial;")
dbExecute(con, "INSTALL httpfs;")
dbExecute(con, "LOAD httpfs;")
dbExecute(con, "SET s3_region='us-west-2';")
dbSendQuery(con, "SET enable_progress_bar = true;")
dbSendQuery(con, "SET enable_progress_bar_print = true;")
dbGetQuery(con, "SELECT current_setting('enable_progress_bar');")
dbGetQuery(con, "SELECT current_setting('enable_progress_bar_print');")
query <- "
SELECT
id,
names.primary as primary_name,
height,
ST_GeomFromWKB(geometry) as geometry
FROM read_parquet('s3://overturemaps-us-west-2/release/2024-06-13-beta.1/theme=buildings/type=*/*', filename=TRUE, hive_partitioning=1)
WHERE primary_name IS NOT NULL
AND bbox.xmin > -83.00
AND bbox.xmax < -83.36
AND bbox.ymin > 43.00
AND bbox.ymax < 43.33;
"
x <- dbGetQuery(con, query)
dbDisconnect(con, shutdown = TRUE)
Python
import duckdb
con = duckdb.connect()
con.execute("INSTALL spatial;")
con.execute("LOAD spatial;")
con.execute("INSTALL httpfs;")
con.execute("LOAD httpfs;")
con.execute("SET s3_region='us-west-2';")
con.execute("SET enable_progress_bar = true;")
con.execute("SET enable_progress_bar_print = true;")
print(con.execute("SELECT current_setting('enable_progress_bar');").fetchall())
print(con.execute("SELECT current_setting('enable_progress_bar_print');").fetchall())
query = """
SELECT
id,
names.primary as primary_name,
height,
ST_GeomFromWKB(geometry) as geometry
FROM read_parquet('s3://overturemaps-us-west-2/release/2024-06-13-beta.1/theme=buildings/type=*/*', filename=TRUE, hive_partitioning=1)
WHERE primary_name IS NOT NULL
AND bbox.xmin > -83.00
AND bbox.xmax < -83.36
AND bbox.ymin > 43.00
AND bbox.ymax < 43.33;
"""
x = con.execute(query).fetchall()
con.close()