Is it possible to store the alembic connect string outside of alembic.ini?

后端 未结 10 1606
[愿得一人]
[愿得一人] 2021-01-30 15:41

I\'m using Alembic with SQL Alchemy. With SQL Alchemy, I tend to follow a pattern where I don\'t store the connect string with the versioned code. Instead I have file secr

10条回答
  •  被撕碎了的回忆
    2021-01-30 16:15

    Another solution is to create a template alembic.ini.dist file and to track it with your versionned code, while ignoring alembic.ini in your VCS.

    Do not add any confidential information in alembic.ini.dist:

    sqlalchemy.url = ...
    

    When deploying your code to a platform, copy alembic.ini.dist to alembic.ini (this one won't be tracked by your VCS) and modify alembic.ini with the platform's credentials.

提交回复
热议问题