def test_onecolumn(exname, colno): if exname == "t0" and colno > 0: pytest.skip("Not enough columns in %s." % (exname,)) if exname.startswith("t1_sub") and colno > 1: pytest.skip("Not enough columns in %s." % (exname,)) with analyzed_bayesdb_generator(examples[exname](), 1, 1) as (bdb, generator_id): bqlfn.bql_column_value_probability(bdb, generator_id, None, colno, 4) bdb.sql_execute("select bql_column_value_probability(?, NULL, ?, 4)", (generator_id, colno)).fetchall()
def test_onecolumn(exname, colno): if exname == 't0' and colno > 0: pytest.skip('Not enough columns in %s.' % (exname, )) if exname.startswith('t1_sub') and colno > 1: pytest.skip('Not enough columns in %s.' % (exname, )) with analyzed_bayesdb_generator(examples[exname](), 1, 1) \ as (bdb, generator_id): bqlfn.bql_column_value_probability(bdb, generator_id, None, colno, 4) bdb.sql_execute('select bql_column_value_probability(?, NULL, ?, 4)', (generator_id, colno)).fetchall()
def test_onecolumn(exname, colno): if exname == 't0' and colno > 0: pytest.skip('Not enough columns in %s.' % (exname,)) if exname.startswith('t1_sub') and colno > 1: pytest.skip('Not enough columns in %s.' % (exname,)) with analyzed_bayesdb_population(examples[exname](), 1, 1) \ as (bdb, population_id, generator_id): bqlfn.bql_column_value_probability( bdb, population_id, None, None, colno, 4) bdb.sql_execute( 'select bql_column_value_probability(?, NULL, NULL, ?, 4)', (population_id, colno)).fetchall()
def test_t1_column_value_probability(colno, rowid): with analyzed_bayesdb_generator(t1(), 1, 1) as (bdb, generator_id): if rowid == 0: rowid = bayesdb_maxrowid(bdb, generator_id) value = bayesdb_generator_cell_value(bdb, generator_id, colno, rowid) bqlfn.bql_column_value_probability(bdb, generator_id, None, colno, value) table_name = core.bayesdb_generator_table(bdb, generator_id) colname = core.bayesdb_generator_column_name(bdb, generator_id, colno) qt = bql_quote_name(table_name) qc = bql_quote_name(colname) sql = ''' select bql_column_value_probability(?, NULL, ?, (select %s from %s where rowid = ?)) ''' % (qc, qt) bdb.sql_execute(sql, (generator_id, colno, rowid)).fetchall()
def test_t1_column_value_probability(colno, rowid): with analyzed_bayesdb_population(t1(), 1, 1) \ as (bdb, population_id, generator_id): if rowid == 0: rowid = bayesdb_maxrowid(bdb, population_id) value = core.bayesdb_population_cell_value(bdb, population_id, rowid, colno) bqlfn.bql_column_value_probability(bdb, population_id, None, None, colno, value) table_name = core.bayesdb_population_table(bdb, population_id) var = core.bayesdb_variable_name(bdb, population_id, None, colno) qt = bql_quote_name(table_name) qv = bql_quote_name(var) sql = ''' select bql_column_value_probability(?, NULL, NULL, ?, (select %s from %s where rowid = ?)) ''' % (qv, qt) bdb.sql_execute(sql, (population_id, colno, rowid)).fetchall()
def test_t1_column_value_probability(colno, rowid): with analyzed_bayesdb_population(t1(), 1, 1) \ as (bdb, population_id, generator_id): if rowid == 0: rowid = bayesdb_maxrowid(bdb, population_id) value = core.bayesdb_population_cell_value( bdb, population_id, rowid, colno) bqlfn.bql_column_value_probability( bdb, population_id, None, None, colno, value) table_name = core.bayesdb_population_table(bdb, population_id) var = core.bayesdb_variable_name(bdb, population_id, None, colno) qt = bql_quote_name(table_name) qv = bql_quote_name(var) sql = ''' select bql_column_value_probability(?, NULL, NULL, ?, (select %s from %s where rowid = ?)) ''' % (qv, qt) bdb.sql_execute(sql, (population_id, colno, rowid)).fetchall()