bdb.execute("BEGIN")
try:
with open(fname, "rU") as f:
read_csv.bayesdb_read_csv(bdb, "t", f, header=True,
create=True)
bdb.execute("SELECT * FROM t")
guess.bayesdb_guess_generator(bdb, "t_cc", "t", "crosscat")
bdb.execute("ESTIMATE * FROM t_cc")
finally:
bdb.execute("ROLLBACK")
with pytest.raises(sqlite3.OperationalError):
bdb.execute("SELECT * FROM t")
with pytest.raises(ValueError):
bdb.execute("ESTIMATE * FROM t_cc")
// Make sure CREATE and DROP both work in the transaction.
bdb.execute("BEGIN")
try:
with open(fname, "rU") as f:
read_csv.bayesdb_read_csv(bdb, "t", f, header=True,
create=True)
bdb.execute("SELECT * FROM t")
guess.bayesdb_guess_generator(bdb, "t_cc", "t", "crosscat")
bdb.execute("ESTIMATE * FROM t_cc")
with pytest.raises(ValueError):
bdb.execute("DROP TABLE t")
bdb.execute("DROP GENERATOR t_cc")
with pytest.raises(ValueError):
bdb.execute("ESTIMATE * FROM t_cc")
bdb.execute("DROP TABLE t")
with pytest.raises(sqlite3.OperationalError):
bdb.execute("SELECT * FROM t")
finally:
bdb.execute("ROLLBACK")
with pytest.raises(ValueError):
bdb.execute("ESTIMATE * FROM t_cc")
with pytest.raises(sqlite3.OperationalError):
bdb.execute("SELECT * FROM t")
// Make sure CREATE and DROP work even if we commit.
bdb.execute("BEGIN")
try:
with open(fname, "rU") as f:
read_csv.bayesdb_read_csv(bdb, "t", f, header=True,
create=True)
bdb.execute("SELECT * FROM t")
guess.bayesdb_guess_generator(bdb, "t_cc", "t", "crosscat")
bdb.execute("ESTIMATE * FROM t_cc")
with pytest.raises(ValueError):
bdb.execute("DROP TABLE t")
bdb.execute("DROP GENERATOR t_cc")
with pytest.raises(ValueError):
bdb.execute("ESTIMATE * FROM t_cc")
bdb.execute("DROP TABLE t")
with pytest.raises(sqlite3.OperationalError):
bdb.execute("SELECT * FROM t")
finally:
bdb.execute("COMMIT")
with pytest.raises(ValueError):
bdb.execute("ESTIMATE * FROM t_cc")
with pytest.raises(sqlite3.OperationalError):
bdb.execute("SELECT * FROM t")
// Make sure CREATE persists if we commit.
bdb.execute("BEGIN")
try:
with open(fname, "rU") as f:
read_csv.bayesdb_read_csv(bdb, "t", f, header=True,
create=True)
bdb.execute("SELECT * FROM t")
guess.bayesdb_guess_generator(bdb, "t_cc", "t", "crosscat")
After Change
bdb.execute("BEGIN")
try:
with open(fname, "rU") as f:
bayeslite.bayesdb_read_csv(bdb, "t", f, header=True,
create=True)
bdb.execute("SELECT * FROM t")
guess.bayesdb_guess_generator(bdb, "t_cc", "t", "crosscat")
bdb.execute("ESTIMATE * FROM t_cc")
with pytest.raises(ValueError):
bdb.execute("DROP TABLE t")
bdb.execute("DROP GENERATOR t_cc")
with pytest.raises(ValueError):
bdb.execute("ESTIMATE * FROM t_cc")
bdb.execute("DROP TABLE t")
with pytest.raises(sqlite3.OperationalError):
bdb.execute("SELECT * FROM t")
finally:
bdb.execute("ROLLBACK")
with pytest.raises(ValueError):
bdb.execute("ESTIMATE * FROM t_cc")
with pytest.raises(sqlite3.OperationalError):
bdb.execute("SELECT * FROM t")
// Make sure CREATE and DROP work even if we commit.
bdb.execute("BEGIN")
try:
with open(fname, "rU") as f:
bayeslite.bayesdb_read_csv(bdb, "t", f, header=True,
create=True)
bdb.execute("SELECT * FROM t")
guess.bayesdb_guess_generator(bdb, "t_cc", "t", "crosscat")
bdb.execute("ESTIMATE * FROM t_cc")
with pytest.raises(ValueError):