blob: 63c354f2cb15a5e7b7baf27f49fb62179e9535b9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
import json
# for more https://docs.python.org/3.11/library/sqlite3.html#adapter-and-converter-recipes
# and https://docs.python.org/3.11/library/sqlite3.html#sqlite3.PARSE_DECLTYPES
def adapt_tuple(data: tuple | None) -> str | None:
return json.dumps(data) if data else None
def convert_tuple(data: str | None) -> tuple | None:
return tuple(json.loads(data)) if data else None
|