def bayesdb_get_generator(bdb, name):
    """Return the id of the generator named `name` in `bdb`.

    The id is persistent across savepoints: ids are 64-bit integers
    that increase monotonically and are never reused.

    `bdb` must have a generator named `name`.  If you're not sure,
    call :func:`bayesdb_has_generator` first.
    """
    sql = 'SELECT id FROM bayesdb_generator WHERE name = ?'
    cursor = bdb.sql_execute(sql, (name,))
    try:
        row = cursor.next()
    except StopIteration:
        raise ValueError('No such generator: %s' % (repr(name),))
    else:
        assert isinstance(row[0], int)
        return row[0]
dataset/ETHPy150Open probcomp/bayeslite/src/core.py/bayesdb_get_generator/original