Пример #1
0
 def test_set_database(self):
     # create new connection with no default db set
     env = copy(ENV)
     env.test_data_db = None
     con = connect_test(env)
     self.assertRaises(Exception, con.table, 'functional_alltypes')
     con.set_database(self.test_data_db)
     con.table('functional_alltypes')
Пример #2
0
 def test_set_database(self):
     # create new connection with no default db set
     env = copy(ENV)
     env.test_data_db = None
     con = connect_test(env)
     self.assertRaises(Exception, con.table, 'functional_alltypes')
     con.set_database(self.test_data_db)
     con.table('functional_alltypes')
Пример #3
0
    def test_execute_exprs_default_backend(self):
        cases = [(ibis.literal(2), 2)]

        ibis.options.default_backend = None
        client = connect_test(ENV, with_hdfs=False)
        assert ibis.options.default_backend is client

        for expr, expected in cases:
            result = expr.execute()
            assert result == expected
Пример #4
0
    def test_execute_exprs_default_backend(self):
        cases = [(ibis.literal(2), 2)]

        ibis.options.default_backend = None
        client = connect_test(ENV, with_hdfs=False)
        assert ibis.options.default_backend is client

        for expr, expected in cases:
            result = expr.execute()
            assert result == expected
Пример #5
0
    def test_close_drops_temp_tables(self):
        from posixpath import join as pjoin

        hdfs_path = pjoin(self.test_data_dir, 'parquet/tpch_region')

        client = connect_test(ENV)
        table = client.parquet_file(hdfs_path)

        name = table.op().name
        assert self.con.exists_table(name) is True
        client.close()

        assert not self.con.exists_table(name)
Пример #6
0
    def test_close_drops_temp_tables(self):
        from posixpath import join as pjoin

        hdfs_path = pjoin(self.test_data_dir, 'parquet/tpch_region')

        client = connect_test(ENV)
        table = client.parquet_file(hdfs_path)

        name = table.op().name
        assert self.con.exists_table(name) is True
        client.close()

        assert not self.con.exists_table(name)
Пример #7
0
    def test_rerelease_cursor(self):
        con = connect_test(self.env)

        with con.raw_sql('select 1', True) as cur1:
            pass

        cur1.release()

        with con.raw_sql('select 1', True) as cur2:
            pass

        cur2.release()

        with con.raw_sql('select 1', True) as cur3:
            pass

        assert cur1 == cur2
        assert cur2 == cur3
Пример #8
0
    def test_rerelease_cursor(self):
        con = connect_test(self.env)

        with con.raw_sql('select 1', True) as cur1:
            pass

        cur1.release()

        with con.raw_sql('select 1', True) as cur2:
            pass

        cur2.release()

        with con.raw_sql('select 1', True) as cur3:
            pass

        assert cur1 == cur2
        assert cur2 == cur3
Пример #9
0
 def test_raise_ibis_error_no_hdfs(self):
     # #299
     client = connect_test(ENV, with_hdfs=False)
     self.assertRaises(com.IbisError, getattr, client, 'hdfs')
Пример #10
0
 def test_raise_ibis_error_no_hdfs(self):
     # #299
     client = connect_test(ENV, with_hdfs=False)
     self.assertRaises(com.IbisError, getattr, client, 'hdfs')