duckdb / duckdb-wasm

WebAssembly version of DuckDB
https://shell.duckdb.org
MIT License
1.02k stars 110 forks source link

Parquet encryption not working #1725

Closed msameerbm closed 2 months ago

msameerbm commented 2 months ago

What happens?

Hi, I am planning to use the parquet encryption but it seems its not supported in duckdb-wasm

Binder Error: Invalid named parameter "encryption_config" for function read_parquet
Candidates:
    hive_types_autocast BOOLEAN
    union_by_name BOOLEAN
    hive_types ANY
    hive_partitioning BOOLEAN
    compression VARCHAR
    filename BOOLEAN
    file_row_number BOOLEAN
    binary_as_string BOOLEAN

SELECT * FROM read_parquet('tbl.parquet', encryption_config = {footer_key: 'key128'});

To Reproduce

Try to encrypt the parquet on duckdb backend side and then try to decrypt on WASM.

Encrypt the parquet in duckdb server, using below code

await this.connection.all('PRAGMA add_parquet_key("key128", "0123456789112345")');

return await this.connection.all(
        COPY ${viewName} TO '${fileName}' (ENCRYPTION_CONFIG {footer_key: 'key128'});,
      );

To decrypt,

let duckDbConnection: AsyncDuckDBConnection; // AsyncDuckDB connection imported from @duckdb/duckdb-wasm

await duckDbConnection.query(
    CREATE OR REPLACE TABLE "${tableName}" AS SELECT * FROM read_parquet('${filePath}', encryption_config = {footer_key: 'key128'})
);

Binder Error: Invalid named parameter "encryption_config" for function read_parquet

Browser/Environment:

Version 124.0.6367.79 (Official Build) (arm64)

Device:

Mac (Chrome browser)

DuckDB-Wasm Version:

1..28.1-dev106.0

DuckDB-Wasm Deployment:

duckdb-wasm

Full Name:

Mohamed Sameer

Affiliation:

Lumel

tobilg commented 2 months ago

Have you tried a more recent version? The version you used is more than 3 months old, see https://www.npmjs.com/package/@duckdb/duckdb-wasm?activeTab=versions

msameerbm commented 2 months ago

Thanks @tobilg

Tried using 1.28.1-dev189.0, Parquet encryption working as expected in WASM.