-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Description
I'm looking at the examples in Readme:
Lines 89 to 102 in 01e78be
| ## Fetch Result | |
| To get data from result you need pass result reference from the `Duckdbex.query/2` or `Duckdbex.query/3` call into the `Duckdbex.fetch_all/1` or `Duckdbex.fetch_chunk/1`. The `Duckdbex.fetch_all/1` will return all the data at once. To get data chunk by chunk you should call `Duckdbex.fetch_chunk/1`. | |
| ```elixir | |
| # Run a query and get the reference to the result | |
| {:ok, result_ref} = Duckdbex.query(conn, """ | |
| SELECT userId, movieId, rating FROM ratings WHERE userId = $1; | |
| """, [1]) | |
| # Get all the data from the result reference at once | |
| Duckdbex.fetch_all(result_ref) | |
| # => [[userId: 1, movieId: 1, rating: 6], [userId: 1, movieId: 2, rating: 12]] | |
| ``` |
And it seems that the code should return both column names userId and values 1 but when running Duckdbex on my own console it only returns values.
For example running this:
{:ok, db} = Duckdbex.open()
{:ok, conn} = Duckdbex.connection(db)
{:ok, result_ref} = Duckdbex.query(conn, """
FROM duckdb_extensions() LIMIT 2;
""", [])
Duckdbex.fetch_all(result_ref)results in:
["autocomplete", false, false, "",
"Adds support for autocomplete in the shell", [], "", "NOT_INSTALLED", ""],
["aws", false, false, "", "Provides features that depend on the AWS SDK", [],
"", "NOT_INSTALLED", ""]
Am I just holding it wrong or is the readme wrong?
I would want to get the column names as well. How could I do that?
Metadata
Metadata
Assignees
Labels
No labels