def get_current_head(graph):
    """
    Get the current database head revision, if any.

    """
    session = new_session(graph)
    try:
        result = session.execute("SELECT version_num FROM alembic_version")
    except ProgrammingError:
        return None
    else:
        return result.scalar()
    finally:
        session.close()
Get the current database head revision, if any.