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

Strict mode by default when tables are strict

Open aplavin opened this issue 2 years ago • 3 comments

SQLite supports "strict" mode since 2021: https://www.sqlite.org/stricttables.html. Can SQLite use its strict mode automatically whenever the sqlite database uses it? Should help type stability and performance.

aplavin avatar Jan 23 '23 22:01 aplavin

I think it is all about SQL?

metab0t avatar Jan 23 '23 23:01 metab0t

I don't understand the question. With strict mode, sqlite enforces actual data types to match table schema. This can be used in SQLite.jl to determine types once for a query, and then read all rows type-stably with fewer julia allocations and better performance.

aplavin avatar Jan 24 '23 15:01 aplavin

It means that SQLite.jl needs to parse the table name(s) from SQL first, runs PRAGMA table_list(tbl) to tell whether the table is strict and PRAGMA schema.table_xinfo(tbl) to get types of all columns. I am afraid that it is not worth the additional complexities for a wrapper of SQLite APIs. Anyway, welcome PR and performance comparisons.

metab0t avatar Jan 24 '23 16:01 metab0t