duckdb / duckdb-r

The duckdb R package
https://r.duckdb.org/
Other
104 stars 21 forks source link

Error Writing Encrypted Parquet Files on Windows #136

Open yng-me opened 3 months ago

yng-me commented 3 months ago

I'm trying to execute the code below on Windows (I'm on Windows 11):

# sample keys 
key1 <- "key128"
key2 <- "0123456789112345"

conn <- DBI::dbConnect(duckdb::duckdb())
query_to_encrypt <- paste0("PRAGMA add_parquet_key('", key1, "', '", key2, "');")
DBI::dbExecute(conn, query_to_encrypt)

pq_path <- "./data/sample.parquet"
query <- paste0("COPY sample_df TO '", pq_path , "' (ENCRYPTION_CONFIG { footer_key: '", key1, "'});")

DBI::dbWriteTable(conn, name = "sample_df", value = sample_df, overwrite = T)
DBI::dbExecute(conn, query)

Here's the error I got:

Screenshot 2024-04-01 115933

NOTE: It works seamlessly on my Mac

krlmlr commented 2 months ago

Thanks. What version of duckdb are you using?

This looks like https://github.com/duckdb/duckdb/pull/11069, which has been fixed in duckdb 0.10.1.

yng-me commented 1 month ago

Thanks, @krlmlr. I just installed the latest version and it's now working.