Closed Jaymon closed 1 year ago
This would work but it is about the same amount of cognitive overhead, in order to use this you need to do:
import sqlite3
print(sqlite3.paramstyle)
So for the base class to use this the child classes would need to set the module, something like:
import sqlite3
class SQLite(SQLInterface):
connection_module = sqlite3
and then the base interface can use connection_module
to check paramstyle
. But that's just as much work as setting the val_placeholder
manually so it's probably not worth doing. If we ever implement an interface that uses one of the more exotic styles like numeric
, named
or pyformat
then there will be a bit of refactoring in lots of places and at that point it might be worth implementing this
Instead of specifically setting the param in SQLite and PostgreSQL, use paramstyle and have the base class handle setting the value.
via