Breaking Changes between versions 1.1.3 and 1.60
The type returned by SQLite.tables is not compatible between versions 1.1.3
In version 1.1.3:
julia> typeof(SQLite.tables(db))
NamedTuple{(:name,), Tuple{Vector{Union{Missing, String}}}}
and in version 1.6.0
julia> typeof(SQLite.tables(db))
Vector{SQLite.DBTable} (alias for Array{SQLite.DBTable, 1})
In 1.1.3 I had to use table.name to access the tables and this broke my code when updating to 1.6.0.
According to https://pkgdocs.julialang.org/v1/compatibility/ this shouldn't happen :/
Hope this is helpful to others, Shane
Another issue that breaks my code is that SQLite.tables(db) can not read a database with table names starting with numbers in 1.6.0, but can in 1.1.3
This can be detected with
db = SQLite.DB("test.db")
createSQL = " Create Table If Not Exists '1isanumber' (masterID INTEGER, computationTime DOUBLE)"
SQLite.execute(db,createSQL)
tables=SQLite.tables(db)
println(tables.name)
or with
println(tables)
in 1.6.0
In 1.1.3 this returns
["1isanumber"]
In 1.6.0 this returns
ERROR: SQLiteException("unrecognized token: \"1isanumber\"")
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:146 [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(itr::Base.Generator{Vector{String}, SQLite.var"#37#38"{SQLite.DB}})
@ Base ./array.jl:681
[13] tables(db::SQLite.DB, sink::Function)
@ SQLite ~/.julia/packages/SQLite/aeqsS/src/SQLite.jl:783
[14] tables(db::SQLite.DB)
@ SQLite ~/.julia/packages/SQLite/aeqsS/src/SQLite.jl:778
[15] top-level scope
@ ~/ComputationProjects/TEST/VS1p6p0/test.jl:7
There seems to be some disagreement about what constitutes a valid SQLite database table name https://stackoverflow.com/questions/3694276/what-are-valid-table-names-in-sqlite, but I have been using for years names that start with numbers so unfortunate for me this breaks my code. I'll stick with 1.1.3 for now and keep a look out for updates.