MySQL.jl icon indicating copy to clipboard operation
MySQL.jl copied to clipboard

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

Open asbisen opened this issue 7 months ago • 2 comments

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

asbisen avatar Jul 09 '24 07:07 asbisen