Skip to content

Table Name Problem #322

@eweiss99

Description

@eweiss99

I have an sqlite3 database that has tables with names like x.y and other names without a period. In sqlite and R, this is fine, but when using SQLite.jl the period causes an exception. My work around is to change the period(.) to underscore (_) and revise the R code.

julia> SQLite.tables(db) |> DataFrame
ERROR: SQLiteException("no such table: I.Js")
Stacktrace:
[1] sqliteerror(args::SQLite.DB)
@ SQLite ~/.julia/packages/SQLite/aeqsS/src/SQLite.jl:34
[2] macro expansion
@ ~/.julia/packages/SQLite/aeqsS/src/base.jl:10 [inlined]
[3] prepare_stmt_wrapper
@ ~/.julia/packages/SQLite/aeqsS/src/SQLite.jl:109 [inlined]
[4] SQLite.Stmt(db::SQLite.DB, sql::String; register::Bool)
@ SQLite ~/.julia/packages/SQLite/aeqsS/src/SQLite.jl:146
[5] Stmt
@ ~/.julia/packages/SQLite/aeqsS/src/SQLite.jl:145 [inlined]
[6] prepare
@ ~/.julia/packages/SQLite/aeqsS/src/SQLite.jl:180 [inlined]
[7] execute
@ ~/.julia/packages/DBInterface/1Gmxx/src/DBInterface.jl:130 [inlined]
[8] #execute#2
@ ~/.julia/packages/DBInterface/1Gmxx/src/DBInterface.jl:152 [inlined]
[9] execute
@ ~/.julia/packages/DBInterface/1Gmxx/src/DBInterface.jl:152 [inlined]
[10] (::SQLite.var"#37#38"{SQLite.DB})(tbl::String)
@ SQLite ./none:0
[11] iterate
@ ./generator.jl:47 [inlined]
[12] collect_to!
@ ./array.jl:845 [inlined]
[13] collect_to_with_first!
@ ./array.jl:823 [inlined]
[14] collect(itr::Base.Generator{Vector{String}, SQLite.var"#37#38"{SQLite.DB}})
@ Base ./array.jl:797
[15] tables(db::SQLite.DB, sink::Function)
@ SQLite ~/.julia/packages/SQLite/aeqsS/src/SQLite.jl:783
[16] tables(db::SQLite.DB)
@ SQLite ~/.julia/packages/SQLite/aeqsS/src/SQLite.jl:778
[17] top-level scope

Here's a minimal example:
using SQLite
using DataFrames
db = SQLite.DB()
DBInterface.execute(db,"CREATE TABLE IJs (i INTEGER, j INTEGER)")

This works

SQLite.tables(db) |> DataFrame
DBInterface.execute(db,"CREATE TABLE 'I.Js' (i INTEGER, j INTEGER)")

This throws an exception

SQLite.tables(db) |> DataFrame

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions