add database query debugging option
Gitea/photolib/pipeline/head This commit looks good Details

This commit is contained in:
dave 2023-01-23 22:23:27 -08:00
parent 6958040ad5
commit cb328659cc
1 changed files with 12 additions and 2 deletions

View File

@ -620,10 +620,18 @@ class SearchView(object):
)
def setup_webapp(database_url, library_url, cache_url, thumb_service_url, debug=False, max_upload=1024**3):
def setup_webapp(
database_url,
library_url,
cache_url,
thumb_service_url,
debug=False,
db_debug=False,
max_upload=1024**3
):
# Get database connection
engine = get_db_engine(database_url)
engine = get_db_engine(database_url, debug=db_debug)
# Setup database in web framework
cherrypy.tools.db = SATool()
@ -687,6 +695,7 @@ def main():
parser.add_argument('-s', '--database', help="sqlalchemy database connection uri",
default=os.environ.get("DATABASE_URL")),
parser.add_argument('--debug', action="store_true", help="enable development options")
parser.add_argument('--db-debug', action="store_true", help="print sql statements")
tunables = parser.add_argument_group(title="tunables")
tunables.add_argument('--max-upload', help="maximum file upload size accepted in bytes",
@ -715,6 +724,7 @@ def main():
args.cache,
args.thumb_service,
debug=args.debug,
db_debug=args.db_debug,
max_upload=args.max_upload
)