add sqlite datetime converter

This commit is contained in:
David Lord 2024-11-01 17:18:52 -07:00
parent df201ed152
commit 8aa161a437
No known key found for this signature in database
GPG key ID: 43368A7AA8CC5926
2 changed files with 14 additions and 0 deletions

View file

@ -1,4 +1,5 @@
import sqlite3
from datetime import datetime
import click
from flask import current_app
@ -44,6 +45,9 @@ def init_db_command():
click.echo("Initialized the database.")
sqlite3.register_converter("timestamp", lambda v: datetime.fromisoformat(v.decode()))
def init_app(app):
"""Register database functions with the Flask app. This is called by
the application factory.