All Downloads are FREE. Search and download functionalities are using the official Maven repository.

iotdb.thrift.rpc.IClientRPCService-remote Maven / Gradle / Ivy

The newest version!
#!/usr/bin/env python
#
# Autogenerated by Thrift Compiler (0.14.1)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
#  options string: py
#

import sys
import pprint
if sys.version_info[0] > 2:
    from urllib.parse import urlparse
else:
    from urlparse import urlparse
from thrift.transport import TTransport, TSocket, TSSLSocket, THttpClient
from thrift.protocol.TBinaryProtocol import TBinaryProtocol

from iotdb.thrift.rpc import IClientRPCService
from iotdb.thrift.rpc.ttypes import *

if len(sys.argv) <= 1 or sys.argv[1] == '--help':
    print('')
    print('Usage: ' + sys.argv[0] + ' [-h host[:port]] [-u url] [-f[ramed]] [-s[sl]] [-novalidate] [-ca_certs certs] [-keyfile keyfile] [-certfile certfile] function [arg1 [arg2...]]')
    print('')
    print('Functions:')
    print('  TSExecuteStatementResp executeQueryStatementV2(TSExecuteStatementReq req)')
    print('  TSExecuteStatementResp executeUpdateStatementV2(TSExecuteStatementReq req)')
    print('  TSExecuteStatementResp executeStatementV2(TSExecuteStatementReq req)')
    print('  TSExecuteStatementResp executeRawDataQueryV2(TSRawDataQueryReq req)')
    print('  TSExecuteStatementResp executeLastDataQueryV2(TSLastDataQueryReq req)')
    print('  TSFetchResultsResp fetchResultsV2(TSFetchResultsReq req)')
    print('  TSOpenSessionResp openSession(TSOpenSessionReq req)')
    print('  TSStatus closeSession(TSCloseSessionReq req)')
    print('  TSExecuteStatementResp executeStatement(TSExecuteStatementReq req)')
    print('  TSStatus executeBatchStatement(TSExecuteBatchStatementReq req)')
    print('  TSExecuteStatementResp executeQueryStatement(TSExecuteStatementReq req)')
    print('  TSExecuteStatementResp executeUpdateStatement(TSExecuteStatementReq req)')
    print('  TSFetchResultsResp fetchResults(TSFetchResultsReq req)')
    print('  TSFetchMetadataResp fetchMetadata(TSFetchMetadataReq req)')
    print('  TSStatus cancelOperation(TSCancelOperationReq req)')
    print('  TSStatus closeOperation(TSCloseOperationReq req)')
    print('  TSGetTimeZoneResp getTimeZone(i64 sessionId)')
    print('  TSStatus setTimeZone(TSSetTimeZoneReq req)')
    print('  ServerProperties getProperties()')
    print('  TSStatus setStorageGroup(i64 sessionId, string storageGroup)')
    print('  TSStatus createTimeseries(TSCreateTimeseriesReq req)')
    print('  TSStatus createAlignedTimeseries(TSCreateAlignedTimeseriesReq req)')
    print('  TSStatus createMultiTimeseries(TSCreateMultiTimeseriesReq req)')
    print('  TSStatus deleteTimeseries(i64 sessionId,  path)')
    print('  TSStatus deleteStorageGroups(i64 sessionId,  storageGroup)')
    print('  TSStatus insertRecord(TSInsertRecordReq req)')
    print('  TSStatus insertStringRecord(TSInsertStringRecordReq req)')
    print('  TSStatus insertTablet(TSInsertTabletReq req)')
    print('  TSStatus insertTablets(TSInsertTabletsReq req)')
    print('  TSStatus insertRecords(TSInsertRecordsReq req)')
    print('  TSStatus insertRecordsOfOneDevice(TSInsertRecordsOfOneDeviceReq req)')
    print('  TSStatus insertStringRecordsOfOneDevice(TSInsertStringRecordsOfOneDeviceReq req)')
    print('  TSStatus insertStringRecords(TSInsertStringRecordsReq req)')
    print('  TSStatus testInsertTablet(TSInsertTabletReq req)')
    print('  TSStatus testInsertTablets(TSInsertTabletsReq req)')
    print('  TSStatus testInsertRecord(TSInsertRecordReq req)')
    print('  TSStatus testInsertStringRecord(TSInsertStringRecordReq req)')
    print('  TSStatus testInsertRecords(TSInsertRecordsReq req)')
    print('  TSStatus testInsertRecordsOfOneDevice(TSInsertRecordsOfOneDeviceReq req)')
    print('  TSStatus testInsertStringRecords(TSInsertStringRecordsReq req)')
    print('  TSStatus deleteData(TSDeleteDataReq req)')
    print('  TSExecuteStatementResp executeRawDataQuery(TSRawDataQueryReq req)')
    print('  TSExecuteStatementResp executeLastDataQuery(TSLastDataQueryReq req)')
    print('  i64 requestStatementId(i64 sessionId)')
    print('  TSStatus createSchemaTemplate(TSCreateSchemaTemplateReq req)')
    print('  TSStatus appendSchemaTemplate(TSAppendSchemaTemplateReq req)')
    print('  TSStatus pruneSchemaTemplate(TSPruneSchemaTemplateReq req)')
    print('  TSQueryTemplateResp querySchemaTemplate(TSQueryTemplateReq req)')
    print('  TSStatus setSchemaTemplate(TSSetSchemaTemplateReq req)')
    print('  TSStatus unsetSchemaTemplate(TSUnsetSchemaTemplateReq req)')
    print('  TSStatus dropSchemaTemplate(TSDropSchemaTemplateReq req)')
    print('  TSStatus handshake(TSyncIdentityInfo info)')
    print('  TSStatus sendPipeData(string buff)')
    print('  TSStatus sendFile(TSyncTransportMetaInfo metaInfo, string buff)')
    print('  TSBackupConfigurationResp getBackupConfiguration()')
    print('  TSConnectionInfoResp fetchAllConnectionsInfo()')
    print('  WhiteListInfoResp getWhiteIpSet()')
    print('  TSStatus updateWhiteList( ipSet)')
    print('  LicenseInfoResp getLicenseInfo()')
    print('')
    sys.exit(0)

pp = pprint.PrettyPrinter(indent=2)
host = 'localhost'
port = 9090
uri = ''
framed = False
ssl = False
validate = True
ca_certs = None
keyfile = None
certfile = None
http = False
argi = 1

if sys.argv[argi] == '-h':
    parts = sys.argv[argi + 1].split(':')
    host = parts[0]
    if len(parts) > 1:
        port = int(parts[1])
    argi += 2

if sys.argv[argi] == '-u':
    url = urlparse(sys.argv[argi + 1])
    parts = url[1].split(':')
    host = parts[0]
    if len(parts) > 1:
        port = int(parts[1])
    else:
        port = 80
    uri = url[2]
    if url[4]:
        uri += '?%s' % url[4]
    http = True
    argi += 2

if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed':
    framed = True
    argi += 1

if sys.argv[argi] == '-s' or sys.argv[argi] == '-ssl':
    ssl = True
    argi += 1

if sys.argv[argi] == '-novalidate':
    validate = False
    argi += 1

if sys.argv[argi] == '-ca_certs':
    ca_certs = sys.argv[argi+1]
    argi += 2

if sys.argv[argi] == '-keyfile':
    keyfile = sys.argv[argi+1]
    argi += 2

if sys.argv[argi] == '-certfile':
    certfile = sys.argv[argi+1]
    argi += 2

cmd = sys.argv[argi]
args = sys.argv[argi + 1:]

if http:
    transport = THttpClient.THttpClient(host, port, uri)
else:
    if ssl:
        socket = TSSLSocket.TSSLSocket(host, port, validate=validate, ca_certs=ca_certs, keyfile=keyfile, certfile=certfile)
    else:
        socket = TSocket.TSocket(host, port)
    if framed:
        transport = TTransport.TFramedTransport(socket)
    else:
        transport = TTransport.TBufferedTransport(socket)
protocol = TBinaryProtocol(transport)
client = IClientRPCService.Client(protocol)
transport.open()

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

transport.close()




© 2015 - 2024 Weber Informatics LLC | Privacy Policy