def get_head_revision_from_alembic(
        alembic_config_filename: str,
        alembic_base_dir: str = None,
        version_table: str = DEFAULT_ALEMBIC_VERSION_TABLE) -> str:
    """
    Ask Alembic what its head revision is (i.e. where the Python code would
    like the database to be at).

    Arguments:
        alembic_config_filename: config filename
        alembic_base_dir: directory to start in, so relative paths in the
            config file work.
        version_table: table name for Alembic versions
    """
    if alembic_base_dir is None:
        alembic_base_dir = os.path.dirname(alembic_config_filename)
    os.chdir(alembic_base_dir)  # so the directory in the config file works
    config = Config(alembic_config_filename)
    script = ScriptDirectory.from_config(config)
    with EnvironmentContext(config,
                            script,
                            version_table=version_table):
        return script.get_current_head()
def get_head_revision_from_alembic ( alembic_config_filename : str , alembic_base_dir : str = None , version_table : str = DEFAULT_ALEMBIC_VERSION_TABLE ) -> str : if alembic_base_dir is None : alembic_base_dir = os . path . dirname ( alembic_config_filename ) os . chdir ( alembic_base_dir ) config = Config ( alembic_config_filename ) script = ScriptDirectory . from_config ( config ) with EnvironmentContext ( config , script , version_table = version_table ) : return script . get_current_head ( )
Ask Alembic what its head revision is (i.e. where the Python code would
    like the database to be at).

    Arguments:
        alembic_config_filename: config filename
        alembic_base_dir: directory to start in, so relative paths in the
            config file work.
        version_table: table name for Alembic versions