This PR revises cleans up how values are inserted into the database. Prior to this, all values were converted into escaped strings in Python and then inserted into the database using a custom-generated INSERT query, having minor effects on float precision and generally not being the Correct Way To Do Things.
These changes make it so that database values are only coerced to their required column type before insertion and then insert them into the database directly using q-mark substitution, which is the proper way of inserting data per the sqlite3 Python docs.
This PR also adds checks to ensure that all essential database tables/columns required by the KLibs runtime are present at task launch, and adds a get_columns method to the database to provide a nice API for retrieving the names of the columns in a table (for internal use). Additionally, it deprecates the EntryTemplate class in favour of having Database.insert() as the one correct way of adding data to the database.
Merge Checklist
[x] the PR has been reviewed and all comments are resolved
PR Description
This PR revises cleans up how values are inserted into the database. Prior to this, all values were converted into escaped strings in Python and then inserted into the database using a custom-generated
INSERT
query, having minor effects on float precision and generally not being the Correct Way To Do Things.These changes make it so that database values are only coerced to their required column type before insertion and then insert them into the database directly using q-mark substitution, which is the proper way of inserting data per the sqlite3 Python docs.
This PR also adds checks to ensure that all essential database tables/columns required by the KLibs runtime are present at task launch, and adds a
get_columns
method to the database to provide a nice API for retrieving the names of the columns in a table (for internal use). Additionally, it deprecates the EntryTemplate class in favour of havingDatabase.insert()
as the one correct way of adding data to the database.Merge Checklist
closes #<issue-number>
to automatically close an issue