pgcontents/utils/migrate.py
def temp_alembic_ini(alembic_dir_location, sqlalchemy_url):
    """
    Temporarily write an alembic.ini file for use with alembic migration
    scripts.
    """
    with TemporaryDirectory() as tempdir:
        alembic_ini_filename = join(tempdir, 'temp_alembic.ini')
        with open(alembic_ini_filename, 'w') as f:
            f.write(
                ALEMBIC_INI_TEMPLATE.format(
                    alembic_dir_location=alembic_dir_location,
                    sqlalchemy_url=sqlalchemy_url,
                )
            )
        yield alembic_ini_filename
def temp_alembic_ini(alembic_dir_location, sqlalchemy_url):
    """
    Temporarily write an alembic.ini file for use with alembic migration
    scripts.
    """
    with TemporaryDirectory() as tempdir:
        alembic_ini_filename = join(tempdir, 'temp_alembic.ini')
        with open(alembic_ini_filename, 'w') as f:
            f.write(
                ALEMBIC_INI_TEMPLATE.format(
                    alembic_dir_location=alembic_dir_location,
                    sqlalchemy_url=sqlalchemy_url,
                )
            )
        yield alembic_ini_filename
Temporarily write an alembic.ini file for use with alembic migration
    scripts.