Skip to content

Long queries can't be saved in the url for sharing from shell.duckdb.orgΒ #2079

@onnimonni

Description

@onnimonni

What happens?

Hey,

If one tries to share more than 3841 characters query with https://shell.duckdb.org it will truncate the rest of the characters and the query will fail.

Typescript sandbox https://www.typescriptlang.org/play solves this problem by compressing the string with lz4 and then doing a base64 encoding. See an example here: https://github.com/microsoft/TypeScript-Website/blob/471221d325c5664d3d4bfc30dfd8d2e882a007f1/packages/sandbox/src/compilerOptions.ts#L130

They use this library to achieve it: https://github.com/pieroxy/lz-string

(Thanks @akx for showing me this πŸ™‡)

I know duckdb has zero dependencies policy for the most part but could we add lz-string or somehow expose zstd and base64 encoding from the duckdb-wasm so that the query parameter can be decoded using duckdb-wasm itself.

Because of this even very very long dad joke typescript examples by courtesy of Gemini can be shared easily.

To Reproduce

Paste this long sql to https://shell.duckdb.org and try to click "Save URL-encoded queries" button. The resulting url will truncated and will not contain the whole thing:
DadJokeAnalysisEngine.txt

Browser/Environment:

Safari Version 18.6 (20621.3.11.11.3)

Device:

MacBook Pro M1 Pro

DuckDB-Wasm Version:

@duckdb/[email protected]

DuckDB-Wasm Deployment:

shell.duckdb.org

Full Name:

Onni Hakala

Affiliation:

Freelancer

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions