JuliaDatabases / MySQL.jl

Access MySQL from Julia
https://juliadatabases.github.io/MySQL.jl/dev
Other
107 stars 37 forks source link

Error: DBInterface.execute(conn, "SHOW TABLES;") #219

Open asbisen opened 2 months ago

asbisen commented 2 months ago

The cursor from "SHOW TABLES;" fails to materialize into a DataFrame. Below is the example

using DataFrames
using MySQL

conn = DBInterface.connect(MySQL.Connection, "127.0.0.1", "root", "password"; port=3306)

r = DBInterface.execute(conn, "DROP DATABASE IF EXISTS testx;") |> DataFrame
r = DBInterface.execute(conn, "CREATE DATABASE testx;") |> DataFrame
println(r)

r = DBInterface.execute(conn, "USE testx;") |> DataFrame
println(r)

sql = """create table LOC  (
    location_id VARCHAR(100),
    alias VARCHAR(50));
    """
r = DBInterface.execute(conn, sql) |> DataFrame
println(r)

r = DBInterface.execute(conn, "SHOW TABLES;") |> DataFrame
println(r)

Error:

ERROR: ArgumentError: invalid number format LOC
Stacktrace:
  [1] parse(::Type{DecFP.Dec64}, s::String)
    @ DecFP ~/.julia/packages/DecFP/Cud5F/src/DecFP.jl:323
  [2] cast
    @ ~/.julia/packages/MySQL/NMNbH/src/execute.jl:50 [inlined]
  [3] getcolumn
    @ ~/.julia/packages/MySQL/NMNbH/src/execute.jl:105 [inlined]
  [4] eachcolumns
    @ ~/.julia/packages/Tables/NSGZI/src/utils.jl:111 [inlined]
  [5] buildcolumns(schema::Tables.Schema{(:Tables_in_testx,), Tuple{DecFP.Dec64}}, rowitr::MySQL.TextCursor{true})
    @ Tables ~/.julia/packages/Tables/NSGZI/src/fallbacks.jl:147
  [6] _columns
    @ ~/.julia/packages/Tables/NSGZI/src/fallbacks.jl:265 [inlined]
  [7] columns
    @ ~/.julia/packages/Tables/NSGZI/src/fallbacks.jl:258 [inlined]
  [8] DataFrame(x::MySQL.TextCursor{true}; copycols::Nothing)
    @ DataFrames ~/.julia/packages/DataFrames/58MUJ/src/other/tables.jl:57
  [9] DataFrame
    @ ~/.julia/packages/DataFrames/58MUJ/src/other/tables.jl:48 [inlined]
 [10] |>(x::MySQL.TextCursor{true}, f::Type{DataFrame})
    @ Base ./operators.jl:917
 [11] top-level scope
    @ REPL[113]:1

Update: this issue only happens with MariaDB 11.2.4 and not with 10.11.8

serenity4 commented 2 weeks ago

I stumbled upon a similar error, and managed to fix the issue by removing the strict version bound on MariaDB_Connector_C_jll ("=3.1.12" to "3.1.12"). With the latest version of this dependency (3.3.9 at the time of writing), I can at least get columns (not sure what else might break though).

serenity4 commented 1 week ago

This is actually a duplicate of #208 already.