Just a quick note: the begin and end iterator might be different types, as a recent improvement in STL provides for end to be a special "sentinel" type that's different from the normal iterator.
If you're using C++20, you can use Concepts to declare the template arguments, to ensure that they are iterators (and sentinels, respectively) to the ...
Just a few quick observations:
/* sqlite constructor */
Duh. Keep comments useful and meaningful. You don't need to explain that the ctor and dtor are those things.
(const std::string& table_name,
Suggest you use std::string_view (by value) for parameters instead. This is more optimal if you pass a lexical string literal, as it doesn't have to copy ...
There are multiple things that I would like to point out to you, just to help you improve coding style. Currently you are not noticing as performance issues as they are hidden due to you DB performance.
Fixed values: You are computing fixed list every time through 'range'. Try to store them in list. As this is unnecessary compute overhead.
File writing: ...