n one of the python projects I'm working on we are using alembic to handle the DB migration scripts. Lately he had an incident when container ,in which alembic upgrade head is running, got stucked ( by some locks on the DB set the the runtime app) and eventually timed out without giving any details of what was going on. Finally we managed to get access to prod DB (which under normal circumstances we are not allow to access. this is something imposed by our cloudops team, for security reasons). So in order to eas our debugging process, i would like to enable verbose mode when calling "alembic upgrade head", this without having to add a tone of logs on top of the migration scripts.
I found that --verbose flag is accepted for some alembic operations, but for some reasons "alembic upgrade head" doesn't allow it.
usage: alembic [-h] [-c CONFIG] [-n NAME] [-x X] [--raiseerr] {branches,current,downgrade,edit,heads,history,init,list_templates,merge,revision,show,stamp,upgrade} ... alembic: error: unrecognized arguments: --verbose
This is the call generating the error above: alembic upgrade head --verbose
Any idea on how I can enable verbosity on upgrade?
Thanks
--You received this message because you are subscribed to the Google Groups "sqlalchemy-alembic" group.To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy-alem...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy-alembic/64462a6a-2d12-491d-b613-e9b4ba9b7ffb%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy-alembic+unsub...@googlegroups.com.
OK I managed to get some logging (it seems my alembic env.py was missing the fileConfig(config.config_file_name)). But still I'm not getting what i want.Basically i want a long entry for every single operation in the migration script. And this, if possible, without having to add log statements all over the place. Is that possible ?
--You received this message because you are subscribed to the Google Groups "sqlalchemy-alembic" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy-alem...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy-alembic/b0dc3a7e-cb00-456c-9e51-51dc56294380%40googlegroups.com.
SQL logging will render all the SQL being emitted which should be enough to see everything the script is doing against the database. that is, if you ran op.alter_column(), you'd see "ALTER COLUMN..." in the log. not sure what else you are looking to see.do you think you're having a deadlock in Python and not against the database? there's no good way to debug that without using something like pdb or embedding print statements. that's a very unusual kind of issue in a tool like alembic and there are no known issues which could cause this.On Thu, Feb 27, 2020, at 1:12 PM, doi zece wrote:
OK I managed to get some logging (it seems my alembic env.py was missing the fileConfig(config.config_file_name)). But still I'm not getting what i want.Basically i want a long entry for every single operation in the migration script. And this, if possible, without having to add log statements all over the place. Is that possible ?
--You received this message because you are subscribed to the Google Groups "sqlalchemy-alembic" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy-alembic+unsub...@googlegroups.com.
Yes I want to see the SQLs hitting the DB. The initial issue I've mentioned got resolved. What I'm trying now is to generate more logs, so that it will be easier for me to investigate future similar issues.When you say "SQL logging will render all the SQL" you mean i have to configure a new logger for this ? like [logger_sql] ?With the configuration I've posted i only get this:
[logger_sqlalchemy] level = INFO handlers = qualname = sqlalchemy.engine
To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy-alem...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy-alembic/2a0c7215-c551-472b-be83-cf15f34bb118%40googlegroups.com.