Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# e6data Python Connector

![version](https://img.shields.io/badge/version-1.0.6-blue.svg)
![version](https://img.shields.io/badge/version-1.0.7-blue.svg)

## Introduction

Expand Down
63 changes: 60 additions & 3 deletions e6xdb/e6x.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,24 @@ def get_tables_v2(self, catalog_name, database):
return self._client.getTablesV2(sessionId=self.get_session_id, catalogName=catalog_name, schema=database)

def get_columns(self, database, table):
catalog_name = ''
return self._client.getColumns(sessionId=self.get_session_id, catalogName=catalog_name, schema=database,
table=table)
return self._client.getColumns(sessionId=self.get_session_id, schema=database, table=table)

def status(self, query_id):
return self._client.status(sessionId=self.get_session_id, queryId=query_id)

def get_add_catalog_response(self):
"""
Response Type:
AddCatalogsResponse(status='success', failures=[])
Usage:
response.status: success, in_progress, failed

Error Usage:
response = conn.get_add_catalog_response()
if response.status == 'error'
print(response.failures[0].reason)
"""
return self._client.getAddCatalogsResponse(sessionId=self.get_session_id)

def get_columns_v2(self, catalog_name, database, table):
return self._client.getColumnsV2(
Expand Down Expand Up @@ -501,3 +516,45 @@ class Error(Exception):
for type_id in PRIMITIVE_TYPES:
name = TypeId._VALUES_TO_NAMES[type_id]
setattr(sys.modules[__name__], name, DBAPITypeObject([name]))


if __name__ == '__main__':
ip = '54.205.255.188'
conn = Connection(
host=ip,
username='admin',
password='admin',
port=9000
)
catalogs = {'catalogs': [{
"type": 'HIVE',
"name": 'hive',
"hive_ip": '18.233.112.169',
"hive_port": 9084,
"included_schemas": [],
"excluded_schemas": [],
"included_tables": [],
"excluded_tables": [],
"included_columns": [],
"excluded_columns": [],
"is_assumed_role": False,
"assumed_role_arn": '',
"default": True
}]}
import json
import time
start = time.time()
# print(conn.add_catalogs(json.dumps(catalogs)))
add_cat_time = time.time()
print('Add catalog time', add_cat_time - start)
status = 'in_progress'
res = conn.get_add_catalog_response()
print(res)
print(res.failures[0].reason)
# while status == 'in_progress':
# res = conn.get_add_catalog_response()
# status = res.status
# print(res)
# time.sleep(5)
print('get_add_catalog_response time', time.time() - add_cat_time)

22 changes: 18 additions & 4 deletions e6xdb/server/QueryEngineService-remote
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,13 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help':
print(' getTablesV2(string sessionId, string catalogName, string schema)')
print(' getSchemaNames(string sessionId)')
print(' getSchemaNamesV2(string sessionId, string catalogName)')
print(' getColumns(string sessionId, string catalogName, string schema, string table)')
print(' getColumns(string sessionId, string schema, string table)')
print(' getColumnsV2(string sessionId, string catalogName, string schema, string table)')
print(' void updateUsers(string userInfo)')
print(' void setProps(string sessionId, string propMap)')
print(' Status status(string sessionId, string queryId)')
print(' void addCatalogs(string sessionId, string jsonString)')
print(' AddCatalogsResponse getAddCatalogsResponse(string sessionId)')
print('')
sys.exit(0)

Expand Down Expand Up @@ -228,10 +230,10 @@ elif cmd == 'getSchemaNamesV2':
pp.pprint(client.getSchemaNamesV2(args[0], args[1],))

elif cmd == 'getColumns':
if len(args) != 4:
print('getColumns requires 4 args')
if len(args) != 3:
print('getColumns requires 3 args')
sys.exit(1)
pp.pprint(client.getColumns(args[0], args[1], args[2], args[3],))
pp.pprint(client.getColumns(args[0], args[1], args[2],))

elif cmd == 'getColumnsV2':
if len(args) != 4:
Expand All @@ -251,12 +253,24 @@ elif cmd == 'setProps':
sys.exit(1)
pp.pprint(client.setProps(args[0], args[1],))

elif cmd == 'status':
if len(args) != 2:
print('status requires 2 args')
sys.exit(1)
pp.pprint(client.status(args[0], args[1],))

elif cmd == 'addCatalogs':
if len(args) != 2:
print('addCatalogs requires 2 args')
sys.exit(1)
pp.pprint(client.addCatalogs(args[0], args[1],))

elif cmd == 'getAddCatalogsResponse':
if len(args) != 1:
print('getAddCatalogsResponse requires 1 args')
sys.exit(1)
pp.pprint(client.getAddCatalogsResponse(args[0],))

else:
print('Unrecognized method %s' % cmd)
sys.exit(1)
Expand Down
Loading