python使用jdbc连接hive

At last,I figure it out finally. But I think is not a great idea to use this component to connect hive, it's depend lots of jar package, and you must install jar package with python-java debug REPL(mostly you are guessing),it is bad.

refer : https://github.com/ghostyusheng/python-hive-jdbc

# -*- coding: utf8 -*-

import jaydebeapi
import os


class Jdbc:
    base_sql = [
        "set hive.mapred.mode=nonstrict",
        "set hive.strict.checks.cartesian.product=false",
        "set hive.execution.engine=tez"
    ]

    def query(self, sql, db = 'tap_ods'):  
        url = 'jdbc:hive2://xx.xx:10000/' + db
        dirver = 'org.apache.hive.jdbc.HiveDriver'
        DIR = os.getcwd() + '/lib/'
        jarFile = [
            DIR + 'hive-jdbc-3.1.1.jar',
            DIR + 
评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值