コード例 #1
0
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from tajo.client import TajoClient

client = TajoClient("http://127.0.0.1:26880/rest", username='******')
client.execute_query_wait_result('create table "Test2" (col1 int)')
client.execute_query_wait_result('insert into "Test2" select 1')
client.execute_query_wait_result('insert into "Test2" select 2')
client.execute_query_wait_result('insert into "Test2" select 3')

resultset = client.execute_query_wait_result('select * from "Test2"')
while True:
    t = resultset.next_tuple()
    if t is None:
        break

    print(t)

client.execute_query_wait_result('drop table "Test2" purge')
コード例 #2
0
from tajo.client import TajoClient

client = TajoClient("http://127.0.0.1:26880/rest", username='******')
client.create_database("test123")
databases = client.databases()

for database_name in databases:
    try:
        ret = client.database_info(database_name)
        print(ret)
    except:
        pass

client.delete_database("test123")
コード例 #3
0
from tajo.client import TajoClient

client = TajoClient("http://127.0.0.1:26880/rest", username="******")
functions = client.functions()
for f in functions:
    print(f)
コード例 #4
0
import sys

import tajo.proto.TajoMasterClientProtocol_pb2 as TajoMasterClientProtocol_pb2
import tajo.proto.TajoIdProtos_pb2 as TajoIdProtos_pb2
import tajo.proto.ClientProtos_pb2 as ClientProtos_pb2

from tajo.rpc.service import RpcService
from tajo.channel import TajoRpcChannel
from tajo.client import TajoClient

HOST = "127.0.0.1"
PORT = 26002

client = TajoClient(HOST, PORT, "tmpuser")
resultSet = client.executeQueryAndGetResult("select * from table1")
# resultSet = client.executeQueryAndGetResult("select 1")
while True:
    t = resultSet.nextTuple()
    if t is None:
        break

    print t
    resultSet.next()
コード例 #5
0
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from tajo.client import TajoClient

client = TajoClient("http://127.0.0.1:26880/rest", username='******')
queries = client.queries()
for query in queries:
    print(query)
コード例 #6
0
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from tajo.client import TajoClient

client = TajoClient("http://127.0.0.1:26880/rest", username='******')

client.execute_query_wait_result('create table Test1 (col1 int)')
client.execute_query_wait_result('create table Test2 (col1 int)')
client.execute_query_wait_result('create table Test3 (col1 int)')
client.execute_query_wait_result('create table Test4 (col1 int)')

tables = client.tables("default")
print(tables)
for table in tables:
    t = client.table("default", table.name)
    print(t)

client.execute_query_wait_result('drop table Test1 purge')
client.execute_query_wait_result('drop table Test2 purge')
client.execute_query_wait_result('drop table Test3 purge')
コード例 #7
0
from tajo.client import TajoClient

client = TajoClient("http://127.0.0.1:26880/rest", username='******')
cluster_info = client.cluster_info()
print(cluster_info)
コード例 #8
0
import sys

import tajo.proto.TajoMasterClientProtocol_pb2 as TajoMasterClientProtocol_pb2
import tajo.proto.TajoIdProtos_pb2 as TajoIdProtos_pb2
import tajo.proto.ClientProtos_pb2 as ClientProtos_pb2

from tajo.rpc.service import RpcService
from tajo.channel import TajoRpcChannel
from tajo.client import TajoClient

HOST = "127.0.0.1"
PORT = 26002

client = TajoClient(HOST, PORT, "tmpuser")
resultSet = client.executeQueryAndGetResult("select * from table1")
#resultSet = client.executeQueryAndGetResult("select 1")
while True:
    t = resultSet.nextTuple()
    if t is None:
        break

    print t
    resultSet.next()