We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In sqlite3 I can register converters to get correct data types.
import sqlite3 sqlite3.register_adapter(bool, int) # <------- sqlite3.register_converter("BOOLEAN", lambda v: bool(int(v))) # <------- db = sqlite3.connect(':memory:', detect_types=sqlite3.PARSE_DECLTYPES) db.execute('CREATE TABLE foo (bar BOOLEAN)') db.execute('INSERT INTO foo VALUES (?)', (True,)) db.execute('INSERT INTO foo VALUES (?)', (False,)) for row in db.execute('SELECT * FROM foo'): print(row)
Output: (True,) (False,)
I can't use register_converter
aiosqlite.register_adapter(bool, int) aiosqlite.register_converter("BOOLEAN", lambda v: bool(int(v)))
Thats take no effect
Output: (1,) (0,)
The text was updated successfully, but these errors were encountered:
I'm still hitting this. Exact same scenario.
Sorry, something went wrong.
I was able to work around this:
sqlite3.register_adapter(bool, int) sqlite3.register_converter("BOOLEAN", lambda v: bool(int(v))) connection = await aiosqlite.connect(DATABASE, detect_types=sqlite3.PARSE_DECLTYPES)
Note that I had to use sqlite3 to set up the converter, and to specify the detect_types argument.
sqlite3
detect_types
@wreimers Thanks for sharing the workaround. It's odd that aiosqlite.register_adapter seems to work but the converter does not.
aiosqlite.register_adapter
No branches or pull requests
Description
In sqlite3 I can register converters to get correct data types.
I can't use register_converter
Thats take no effect
Details
The text was updated successfully, but these errors were encountered: