def bayesdb_generator_fresh_row_id(bdb, generator_id):
    table_name = bayesdb_generator_table(bdb, generator_id)
    qt = sqlite3_quote_name(table_name)
    cursor = bdb.sql_execute('SELECT MAX(_rowid_) FROM %s' % (qt,))
    max_rowid = cursor_value(cursor)
    if max_rowid is None:
        max_rowid = 0
    return max_rowid + 1   # Synthesize a non-existent SQLite row id

# XXX This should be stored in the database by adding a column to the
# bayesdb_stattype table -- when we are later willing to contemplate
# adding statistical types, e.g. COUNT, SCALE, or NONNEGATIVE REAL.
dataset/ETHPy150Open probcomp/bayeslite/src/core.py/bayesdb_generator_fresh_row_id/original