Enabling SQL Commands for SQLAlchemy / Pyramid from the Command Line

I am using Pyramid with SQLAlchemy and I have the following section in mine development.ini:

[logger_sqlalchemy]
# level = INFO
level = WARN
handlers =
qualname = sqlalchemy.engine

Whenever I want to include SQL statement / echo, I edit this file and change the comment to become level = INFO.

My question is: how can I do this from the command line without editing the file in a text editor.

Other web frameworks have built-in support for this, but I could not find a solution for Pyramid / SQLAlchemy.

I would like to support pserve, pshelland alembic.

+4
source share
1 answer

pyramid_sqlalchemy, --sql-echo, , .

:

import logging
logging.getLogger('sqlalchemy.engine').setLevel('INFO')

pserve pshell , , - .

alembic env.py.

+3

Source: https://habr.com/ru/post/1626573/


All Articles