1

I'm using this approach to talk to an external database in my alembic migration. I can run SELECT statements and read data from the other database, but the alembic migration always ends up hanging after running my statements. I've noticed that removing...

Session = sessionmaker(bind=engine)
session = Session() 

... fixes the issue, but I obviously can't do much without that.

I see no errors, what could be going on?

jgozal
  • 1,480
  • 6
  • 22
  • 43
  • I don't think you need a session here; you probably just need to run alembic within the SSL context. – snakecharmerb Sep 04 '20 at 06:18
  • @snakecharmerb thanks. Can you elaborate more in an answer? – jgozal Sep 04 '20 at 06:39
  • What I mean is, generally we don't create a session prior to running alembic upgrades; alembic handles all the db stuff itself, it should only need to know the connection url, which should be in alembic.ini. So if the migration doesn't work without a session, more information is required (error messages, tracebacks etc) – snakecharmerb Sep 04 '20 at 17:22
  • @snakecharmerb unfortunately I see no error messages, no tracebacks etc. The migration just hangs, but I see what you're saying... I'm trying to configure the second database using the .ini and env.py files – jgozal Sep 04 '20 at 17:29
  • @snakecharmerb I created a more specific question for what I think would resolve this issue. Please see https://stackoverflow.com/questions/63746113/add-a-second-db-to-alembic-context – jgozal Sep 04 '20 at 18:08

0 Answers0