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 ? On Thursday, February 27, 2020 at 12:54:56 PM UTC-5, doi zece wrote: > > I've tried that already but with no success. I also tried to change the > alembic version (move to the latest one) as initially i was on a 0.8.x . > Still no luck. > The only way that i manage to make it print someting in the console was to > add print statement in the script. > > This is the current state of my alembic.ini file relevant to alembic > configuration: > > > > [alembic] > script_location = bolt/core/db/migrations > > > [loggers] > keys = root,tornado,server,sqlalchemy,alembic,httpclient,cookies > > [handlers] > keys = file,http,console > > [formatters] > keys = detailed > > [handler_console] > class = StreamHandler > args = (sys.stdout,) > formatter = detailed > level = NOTSET > > [handler_file] > class = FileHandler > args = ('server.log',) > formatter = detailed > level = NOTSET > > [handler_http] > class = FileHandler > args = ('http.log',) > formatter = detailed > level = NOTSET > > [logger_root] > level = DEBUG > propagate = 0 > handlers = file, console > > [logger_tornado] > level = DEBUG > qualname = tornado > propagate = 0 > handlers = file, console > > [logger_sqlalchemy] > level = WARN > handlers = file, console > qualname = sqlalchemy.engine > > [logger_alembic] > level = INFO > handlers = file, console > qualname = alembic > > [logger_httpclient] > level = INFO > qualname = tornado.curl_httpclient > handlers = http, console > > [logger_server] > level = DEBUG > qualname = webserver > propagate = 0 > handlers = file, console > > [logger_cookies] > level = CRITICAL > qualname = cookies > propagate = 0 > handlers = file, console > > [formatter_detailed] > format = [%(name)s] %(asctime)-15s %(levelname)s %(module)s:%(lineno)d: > %(message)s > > > > > > On Thursday, February 27, 2020 at 9:50:10 AM UTC-5, Mike Bayer wrote: >> >> the --verbose flag is only used for a command like "alembic history" to >> provide more detail. to see Alembic doing its work you want to enable >> logging. in the ini file (see >> https://alembic.sqlalchemy.org/en/latest/tutorial.html#editing-the-ini-file) >> <https://alembic.sqlalchemy.org/en/latest/tutorial.html#editing-the-ini-file> >> >> you want to set [logger_sqlalchemy] level to INFO or DEBUG. this will show >> you every SQL statement emitted which should give you an idea of the one >> that is hanging. DROP TABLE is a likely culprit as many databases won't >> allow this if there are open transactions accessing that table. >> >> >> On Thu, Feb 27, 2020, at 8:10 AM, doi zece wrote: >> >> 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-alembic+unsubscr...@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 >> >> <https://groups.google.com/d/msgid/sqlalchemy-alembic/64462a6a-2d12-491d-b613-e9b4ba9b7ffb%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >> >> -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sqlalchemy-alembic/2eac728d-e002-4398-a1ff-c5addb2cb7ce%40googlegroups.com.