def __init__(self, *args, **kwargs): self.con = connect(*args, **kwargs) for table in self.con.tables(): # Better than overriding __getattr__(), because we get tab completion setattr(self, table[0], T(self.con, table[0]))
def setUp(self): self.c = connect(database='postgres', engine='postgres')
def check_connection_rule(args, kwargs, engine): c = connect(*args, **kwargs) if engine == 'sqlite': assert_true(isinstance(c, SQLiteConnection)) else: assert_true(isinstance(c, PostgresqlConnection))
def setUp(self): self.c = connect(database=':memory:', engine='sqlite') self.c("CREATE TABLE people (id, name)") self.c("CREATE TABLE books (id, author, title)")