alexr2d2 / duckdbex Goto Github PK
View Code? Open in Web Editor NEWThe Library embeds C++ DuckDB database into you Elixir application.
License: MIT License
The Library embeds C++ DuckDB database into you Elixir application.
License: MIT License
Shouldn't the spec for appender_close be appender_close and not appender_flush ?
Line 276 in b2c05bd
we use httpfs
to access parquet files in s3
.
Hello,
Is it possible to add the config parameter : allow_unsigned_extensions
?
Wow, finally a wrapper for DuckDB!
There is a discussion about precompiling SQLite for Exqlite, maybe this could be also useful here?
Currently we do not have the latest version of DuckDB in the codebase.
It would be also great to have a Makefile or a bash script to keep the update process reproducible and documented.
For example in Exqlite there is a small bash script for this:
Having the Duckdb version exposed as something accessible in Elixir would help to decide which features / bugs / etc are available to be used.
๐
Here's what I'm running on:
$ uname -a
Darwin mac3.local 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:39:35 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T8103 arm64
Here's what I'm doing:
iex(1)> Mix.install [:duckdbex], force: true
Resolving Hex dependencies...
Resolution completed in 0.032s
New:
cc_precompiler 0.1.7
duckdbex 0.2.3
elixir_make 0.7.6
* Getting duckdbex (Hex package)
* Getting cc_precompiler (Hex package)
* Getting elixir_make (Hex package)
==> elixir_make
Compiling 6 files (.ex)
Generated elixir_make app
==> cc_precompiler
Compiling 3 files (.ex)
Generated cc_precompiler app
==> duckdbex
Compiling 3 files (.ex)
Generated duckdbex app
:ok
iex(2)> {:ok, conn} = Duckdbex.open()
{:ok, #Reference<0.2113251800.2909405206.141355>}
iex(3)> Duckdbex.query(conn, "select 1 + 1")
** (ArgumentError) argument error
(duckdbex 0.2.3) Duckdbex.NIF.query(#Reference<0.2113251800.2909405206.141355>, "select 1 + 1")
iex:5: (file)
Hello,
When I use a integer parameter in my query, the result is empty. But when I replace the value directly in the request I have results. I think the type of the parameter is not match correctly.
iex(27)> query = """
...(27)> WITH p AS (
...(27)> SELECT pdvid,
...(27)> ville,
...(27)> adresse,
...(27)> type_carburant,
...(27)> AVG(prix) as p,
...(27)> ST_MAXDISTANCE(ST_MAKEPOINT($1,$2), point)/1000 as d,
...(27)> MAX(maj)
...(27)> FROM prix
...(27)> WHERE ST_MAXDISTANCE(ST_MAKEPOINT($1,$2), point)/1000 < $3
...(27)> GROUP BY all
...(27)> ORDER BY p ASC)
...(27)> SELECT * FROM p LEFT JOIN stations ON p.pdvid = stations.id
...(27)> ;
...(27)> """
"WITH p AS (\n SELECT pdvid,\n ville,\n adresse,\n type_carburant,\n AVG(prix) as p, \n ST_MAXDISTANCE(ST_MAKEPOINT($1,$2), point)/1000 as d,\n MAX(maj)\n FROM prix\n WHERE ST_MAXDISTANCE(ST_MAKEPOINT($1,$2), point)/1000 < $3\n GROUP BY all\n ORDER BY p ASC)\n SELECT * FROM p LEFT JOIN stations ON p.pdvid = stations.id\n;\n"
iex(28)> {:ok, stmt_ref} = Duckdbex.prepare_statement(conn, query)
{:ok, #Reference<0.2394428590.1507983383.48133>}
iex(29)> {:ok, result_ref} = Duckdbex.execute_statement(stmt_ref, [5.2625, 43.6547, 10])
{:ok, #Reference<0.2394428590.1507983383.48134>}
iex(30)> result = Duckdbex.fetch_all(result_ref)
[]
iex(23)> query = """
...(23)> WITH p AS (
...(23)> SELECT pdvid,
...(23)> ville,
...(23)> adresse,
...(23)> type_carburant,
...(23)> AVG(prix) as p,
...(23)> ST_MAXDISTANCE(ST_MAKEPOINT($1,$2), point)/1000 as d,
...(23)> MAX(maj)
...(23)> FROM prix
...(23)> WHERE ST_MAXDISTANCE(ST_MAKEPOINT($1,$2), point)/1000 < 10
...(23)> GROUP BY all
...(23)> ORDER BY p ASC)
...(23)> SELECT * FROM p LEFT JOIN stations ON p.pdvid = stations.id
...(23)> ;
...(23)> """
"WITH p AS (\n SELECT pdvid,\n ville,\n adresse,\n type_carburant,\n AVG(prix) as p, \n ST_MAXDISTANCE(ST_MAKEPOINT($1,$2), point)/1000 as d,\n MAX(maj)\n FROM prix\n WHERE ST_MAXDISTANCE(ST_MAKEPOINT($1,$2), point)/1000 < 10\n GROUP BY all\n ORDER BY p ASC)\n SELECT * FROM p LEFT JOIN stations ON p.pdvid = stations.id\n;\n"
iex(24)> {:ok, stmt_ref} = Duckdbex.prepare_statement(conn, query)
{:ok, #Reference<0.2394428590.1507983383.48131>}
iex(25)> {:ok, result_ref} = Duckdbex.execute_statement(stmt_ref, [5.2625, 43.6547])
{:ok, #Reference<0.2394428590.1507983383.48132>}
iex(26)> result = Duckdbex.fetch_all(result_ref)
[
[
13410002,
"Lambesc",
"Avenue Jean Monnet",
"E85",
0.8570512820512819,
0.8727622092,
{{2023, 3, 3}, {7, 17, 32, 0}},
"CASINO SUPERMARCHE",
"Casino",
13410002
],
...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.