コード例 #1
0
ファイル: titandb.py プロジェクト: winsena/adapt
 def __init__(self, broker='ws://localhost:8182/'):
     self.broker = broker
     self.loop = asyncio.get_event_loop()
     self.gc = GremlinClient(url=broker, loop=self.loop)
コード例 #2
0
ファイル: testSchema.py プロジェクト: winsena/adapt
#! /usr/bin/env python3

import sys
import asyncio
from aiogremlin import GremlinClient, GremlinServerError

QSuccess = "graph.addVertex('Entity')"  # should insert
QFail = "graph.addVertex('badLabel')"  # should fail to insert

if __name__ == '__main__':
    loop = asyncio.get_event_loop()
    gc = GremlinClient(loop=loop)

    try:
        e = gc.execute(QSuccess)
        r = loop.run_until_complete(e)
        print("Successfully inserted vertex of type Entity as expected")
    except:
        print(
            "Should be able to insert vertex of type 'Entity', schema creation failed: ",
            sys.exc_info()[0])

    try:
        e = gc.execute(QFail)
        r = loop.run_until_complete(e)
        print(
            "Schema creation failed, successful insertion of vertex 'badLabel'"
        )
    except GremlinServerError:
        print("Could not insert vertex of type 'badLabel' as expected")
コード例 #3
0
 def __init__(self):
     self.loop = asyncio.get_event_loop()
     self.gc = GremlinClient(loop=self.loop)