def test_multiple_dbcon(): """ Expr from multiple connections to same DB should be compatible. """ con1 = MockBackend() con2 = MockBackend() con1.table('alltypes').union(con2.table('alltypes')).execute()
def setUp(self): self.con = MockBackend() self.table = self.con.table('functional_alltypes') self.i8 = self.table.tinyint_col self.i16 = self.table.smallint_col self.i32 = self.table.int_col self.i64 = self.table.bigint_col self.d = self.table.double_col self.f = self.table.float_col self.s = self.table.string_col self.b = self.table.bool_col self.t = self.table.timestamp_col self.dec = self.con.table('tpch_customer').c_acctbal self.all_cols = [ self.i8, self.i16, self.i32, self.i64, self.d, self.f, self.dec, self.s, self.b, self.t, ]
def test_ctas_ddl(self): con = MockBackend() select = ImpalaCompiler.to_ast(con.table('test1')).queries[0] statement = ksupport.CTASKudu( 'another_table', 'kudu_name', ['dom.d.com:7051'], select, ['string_col'], external=True, can_exist=False, database='foo', ) result = statement.compile() expected = """\ CREATE EXTERNAL TABLE foo.`another_table` TBLPROPERTIES ( 'kudu.key_columns'='string_col', 'kudu.master_addresses'='dom.d.com:7051', 'kudu.table_name'='kudu_name', 'storage_handler'='com.cloudera.kudu.hive.KuduStorageHandler' ) AS SELECT * FROM test1""" assert result == expected
def test_multiple_db_different_backends(): con1 = MockBackend() con2 = MockAlchemyBackend() backend1_table = con1.table('alltypes') backend2_table = con2.table('alltypes') with pytest.raises(RelationError): backend1_table.union(backend2_table)
def test_multiple_db_different_backends(): con1 = MockBackend() con2 = MockAlchemyBackend() backend1_table = con1.table('alltypes') backend2_table = con2.table('alltypes') expr = backend1_table.union(backend2_table) with pytest.raises( ValueError, match=re.compile("multiple backends", flags=re.IGNORECASE), ): expr.compile()
def setUp(self): self.con = MockBackend() self.name = 'test_name' self.inputs = ['string', 'string'] self.output = 'int64'
def mockcon(): return MockBackend()
def test_multiple_db(): con1 = MockBackend() con2 = MockAlchemyBackend() con1.table('alltypes').union(con2.table('alltypes')).execute()
def con(): return MockBackend()
def setUp(self): self.con = MockBackend()
def setUp(self): self.con = MockBackend() self.alltypes = self.con.table('functional_alltypes')
def con(request): return MockBackend()