def create_temp_gen(bdb, table, target_metamodel, schema):
    gen_name = bdb.temp_table_name()
    gen_id_box = [None]
    def instantiate(columns):
        gen_id, column_list = bql.instantiate_generator(bdb, gen_name, table,
            target_metamodel, columns,
            default=True)
        gen_id_box[0] = gen_id
        return gen_id, column_list
    with bdb.savepoint():
        target_metamodel.create_generator(bdb, table, schema, instantiate)
    return Generator(bdb, target_metamodel, gen_id_box[0], gen_name)
Create a generator.
dataset/ETHPy150Open probcomp/bayeslite/src/geweke_testing.py/create_temp_gen