示例#1
0
    def get_client(self) -> HMSClient:
        from urllib.parse import urlparse
        metastore_uri = urlparse(self.conf[HiveTables.THRIFT_URIS])

        client = hmsclient.HMSClient(host=metastore_uri.hostname,
                                     port=metastore_uri.port)
        return client
示例#2
0
    def get_client(self) -> HMSClient:
        from urllib.parse import urlparse
        iprot = self.conf.get(HiveTables.IPROT)
        oprot = self.conf.get(HiveTables.OPROT)
        metastore_uri = urlparse(self.conf[HiveTables.THRIFT_URIS])

        client = hmsclient.HMSClient(iprot=iprot,
                                     oprot=oprot,
                                     host=metastore_uri.hostname,
                                     port=metastore_uri.port)
        return client
示例#3
0
 def get_client(self) -> HMSClient:
     from urllib.parse import urlparse
     iprot = self.conf.get(HiveTables.IPROT)
     oprot = self.conf.get(HiveTables.OPROT)
     if HiveTables.THRIFT_URIS in self.conf:
         metastore_uri = urlparse(self.conf[HiveTables.THRIFT_URIS])
         client = hmsclient.HMSClient(iprot=iprot,
                                      oprot=oprot,
                                      host=metastore_uri.hostname,
                                      port=metastore_uri.port)
     else:
         if iprot is None:
             raise Exception(
                 "Error when creating hmsclient, either pass in {} or {}".
                 format(HiveTables.THRIFT_URIS, HiveTables.IPROT))
         client = hmsclient.HMSClient(iprot=iprot,
                                      oprot=oprot,
                                      host=None,
                                      port=None)
     return client
示例#4
0
 def _create_client(host, port):
     client = hmsclient.HMSClient(host=host, port=port)
     client.open()
     return client