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

Does this library supports querying Parquet files? #85

Closed
flo8 opened this issue Apr 1, 2023 · 2 comments
Closed

Does this library supports querying Parquet files? #85

flo8 opened this issue Apr 1, 2023 · 2 comments

Comments

@flo8
Copy link

flo8 commented Apr 1, 2023

First of all, thanks for your efforts to enable usage of DuckDB from Go!

DuckDB provides a great way to query Parquet files:
https://duckdb.org/docs/data/parquet/overview.html

Is this something planned in go-duckdb? If not, do you see a way this could be achieved?

Thanks in advance

@marcboeker
Copy link
Owner

Hi @flo8
thanks!

You can query Parquet files like this:

var err error
db, err = sql.Open("duckdb", "?access_mode=READ_WRITE")
if err != nil {
    log.Fatal(err)
}
defer db.Close()

// Install and load Parquet extension
db.Exec("INSTALL parquet; LOAD parquet;") // handle error

row := db.QueryRow("SELECT * FROM read_parquet('users.parquet')")
var (
  id   int
  name string
)
row.Scan(&id, &name) // handle error
fmt.Println(id, name)

@flo8
Copy link
Author

flo8 commented Apr 2, 2023

@marcboeker wow amazing!! thanks a lot 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants