Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing imports to Wasm documentation example #3866

Open
szarnyasg opened this issue Oct 18, 2024 · 0 comments
Open

Add missing imports to Wasm documentation example #3866

szarnyasg opened this issue Oct 18, 2024 · 0 comments
Assignees
Labels
wasm [component] WebAssembly/Wasm

Comments

@szarnyasg
Copy link
Collaborator

Discussed in duckdb/duckdb#14431

Originally posted by lucasl84 October 18, 2024
Hi,

I needed to use the WASM DuckDB for some tests. I was reading the documentation for loading a CSV from a static served file. Is it really too much to ask to have better documentation. In the snippet I'm referring to Apache Arrow is referenced and nowhere imported. Also what c is supposed to be in c.insertCSVFromPath? I got that is the connection, but please avoid this coding/documentation style, is confusing and time wasting (especially for someone that just got started developing or developing with DuckDB). The missing imports I'm referring to are:

import { Int32, Utf8 } from 'apache-arrow';  // Also remove the `arrow.` prefix.

I think examples should always be self-contained: I should be able to copy/paste a snippet and run it without any other extra code or modifications from elsewhere. As I have used DuckDB in the past with Python when providing the columns for CSVs this is done for example with the following types:

duckdb.sql(
    f"""
        INSERT INTO table (
            SELECT *
            FROM read_csv(
                '/SOME_PATH',
                columns={{
                    'COLUMN_A': 'INT',
                    'COLUMN_B': 'STRING',
                    'COLUMN_C': 'BOOL',
                }}
            )
        )
    """
)

In the above snippet the INT, STRING and BOOL types work but in the JS version I need to use Apache Arrow types. Would I also need to use different datatypes library/syntax if I use other existing DuckDB bindings? Couldn't be possible to use plain strings to reference datatypes as above and allow DuckDB behind scenes to do the appropriate conversions for each binding?

Thanks,
Lucas.

@szarnyasg szarnyasg transferred this issue from duckdb/duckdb Oct 18, 2024
@szarnyasg szarnyasg added the wasm [component] WebAssembly/Wasm label Oct 18, 2024
@szarnyasg szarnyasg changed the title Increase documentation quality Add missing imports to Wasm documentation example Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wasm [component] WebAssembly/Wasm
Projects
None yet
Development

No branches or pull requests

2 participants