Closed ruslandoga closed 2 months ago
Hey @ruslandoga i think the problem is the force install. I don't know exactly what's happening under the covers but it doesn't work after just being force-installed in the same session.
Opening another session works fine:
Interactive Elixir (1.17.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> Mix.install [:duckdbex]
:ok
iex(2)> {:ok, db} = Duckdbex.open()
{:ok, #Reference<0.3592413063.3482976278.227186>}
iex(3)> {:ok, conn} = Duckdbex.connection(db)
{:ok, #Reference<0.3592413063.3482976283.226873>}
iex(4)> {:ok, result} = Duckdbex.query(conn, "SELECT 1;")
{:ok, #Reference<0.3592413063.3482976278.227189>}
iex(5)> Duckdbex.columns(result)
["1"]
Hi @ruslandoga could you try the latest release? It looks like you were previously installing precompiled macOS binaries for Intel Arc, but now the binaries are precompiled for ARM
Hey @AlexR2D2 I'm on M1 mac as well and can confirm that it fails as shown if installed for the first time in iex as reported, but works fine when loaded from a mix.exs or in another iex session (without force: true).
The problem is Mix.install [:duckdbex], force: true
and being installed in the same session as it's then being used.
👋 @AlexR2D2
iex(1)> Mix.install [:duckdbex]
Resolving Hex dependencies...
Resolution completed in 0.097s
New:
cc_precompiler 0.1.10
duckdbex 0.3.2
elixir_make 0.8.4
* Getting duckdbex (Hex package)
* Getting cc_precompiler (Hex package)
* Getting elixir_make (Hex package)
==> elixir_make
Compiling 8 files (.ex)
Generated elixir_make app
==> cc_precompiler
Compiling 3 files (.ex)
Generated cc_precompiler app
==> duckdbex
Downloading precompiled NIF to /Users/x/Library/Caches/duckdbex-nif-2.17-aarch64-apple-darwin-0.3.2.tar.gz
Compiling 3 files (.ex)
Generated duckdbex app
:ok
iex(2)> {:ok, conn} = Duckdbex.open()
{:ok, #Reference<0.2243614080.10354711.37132>}
iex(3)> Duckdbex.query(conn, "select 1 + 1")
** (ArgumentError) argument error
(duckdbex 0.3.2) Duckdbex.NIF.query(#Reference<0.2243614080.10354711.37132>, "select 1 + 1")
iex:3: (file)
iex(3)>
This is the first ever install of duckdbex
on this system
$ uname -a
Darwin mac4.local 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:16:46 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T8112 arm64
It's M2 now :)
@ruslandoga if you open a new iex and do the exact same thing again does it work?
👋 @jtippett
iex(1)> Mix.install [:duckdbex]
:ok
iex(2)> {:ok, conn} = Duckdbex.open()
{:ok, #Reference<0.4148936330.816185365.169429>}
iex(3)> Duckdbex.query(conn, "select 1 + 1")
** (ArgumentError) argument error
(duckdbex 0.3.2) Duckdbex.NIF.query(#Reference<0.4148936330.816185365.169429>, "select 1 + 1")
iex:3: (file)
OK, that is weird.
% uname -a
Darwin black-lagoon 23.6.0 Darwin Kernel Version 23.6.0: Mon Jul 29 21:14:30 PDT 2024; root:xnu-10063.141.2~1/RELEASE_ARM64_T6000 arm64
% iex
Erlang/OTP 26 [erts-14.2.5] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit] [dtrace]
Interactive Elixir (1.17.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> Mix.install [:duckdbex]
:ok
iex(2)> {:ok, db} = Duckdbex.open()
{:ok, #Reference<0.1054172198.279838750.82317>}
iex(3)> {:ok, conn} = Duckdbex.connection(db)
{:ok, #Reference<0.1054172198.279838750.82320>}
iex(4)> {:ok, result} =Duckdbex.query(conn, "select 1 + 1")
{:ok, #Reference<0.1054172198.279838750.82321>}
iex(5)> Duckdbex.columns(result)
["(1 + 1)"]
One difference I'm seeing is that I'm on Erlang/OTP 27 [erts-15.0].
$ elixir -v
Erlang/OTP 27 [erts-15.0] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]
Elixir 1.17.1 (compiled with Erlang/OTP 27)
Ah, silly me. I'm using it wrong.
iex(2)> {:ok, db} = Duckdbex.open()
iex(3)> {:ok, conn} = Duckdbex.connection(db)
Oh. I think it's because you're running the query on the db
ref. You need to get the conn
ref.
Lol. Well i missed it too...
I think it's because you're running the query on the db ref. You need to get the conn ref.
Yes, thank you! Sorry for the false alarm :)
and i missed it too ))))
👋
Here's what I'm running on:
Here's what I'm doing: