def tear_down(): # Teardown db from heinzel.core import connection conn = connection.connect() conn.close() from heinzel.core.queries import storage as store store.clear() if os.path.exists(os.path.abspath("test.db")): os.remove("test.db")
def __init__(self, relation, master, identifier, slaves, db=None): self.relation = relation self.master = master self.identifier = identifier # slaves is a list of instances, whose relation to self.master will be # deleted from the linker table. If slaves is empty, all relations # that self.master has to other instances in this linker table, will be # deleted. self.slaves = slaves self.db = db or connection.connect() self.table = link_table_name(MODES[self.relation.mode], self.relation.model.tablename(), self.relation.identifier, self.relation.related_model.tablename() )
def __init__(self, relation, master, identifier, slaves, db=None): self.relation = relation self.master = master self.identifier = identifier assert (self.relation.has_identity(type(self.master), self.identifier)) self.slaves = slaves self.db = db or connection.connect() self.table = link_table_name( MODES[self.relation.mode], self.relation.model.tablename(), self.relation.identifier, self.relation.related_model.tablename() ) self.db_columns = self.db.table_registry[self.table].columns
def __init__(self, model, db=None): self.model = model self.db_table = model.tablename() self.db = db or connection.connect() self.db_columns = self.db.table_registry[self.db_table].columns
def __init__(self, relation, db=None): self.relation = relation self.db = db or connection.connect()
def closeDB(self): from heinzel.core import connection conn = connection.connect() conn.close()
def __init__(self, model, store=None, query=None, db=None): self.model = model self.store = store or storage self.query = query or SelectQuery(model, db) self.db = db or connection.connect()