예제 #1
0
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()
예제 #2
0
    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,
        ]
예제 #3
0
    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
예제 #4
0
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)
예제 #5
0
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()
예제 #6
0
 def setUp(self):
     self.con = MockBackend()
     self.name = 'test_name'
     self.inputs = ['string', 'string']
     self.output = 'int64'
예제 #7
0
def mockcon():
    return MockBackend()
예제 #8
0
def test_multiple_db():
    con1 = MockBackend()
    con2 = MockAlchemyBackend()

    con1.table('alltypes').union(con2.table('alltypes')).execute()
예제 #9
0
def con():
    return MockBackend()
예제 #10
0
 def setUp(self):
     self.con = MockBackend()
예제 #11
0
 def setUp(self):
     self.con = MockBackend()
     self.alltypes = self.con.table('functional_alltypes')
예제 #12
0
파일: conftest.py 프로젝트: jelitox/ibis
def con(request):
    return MockBackend()