Skip to content

Instantly share code, notes, and snippets.

@beltran
Created March 13, 2017 19:05
Show Gist options
  • Save beltran/308a11c4bacde758b446293fea65a08a to your computer and use it in GitHub Desktop.
Save beltran/308a11c4bacde758b446293fea65a08a to your computer and use it in GitHub Desktop.
TimeIO
import logging
from dse_graph import DseGraph
from dse.cluster import Cluster, EXEC_PROFILE_GRAPH_DEFAULT, EXEC_PROFILE_GRAPH_ANALYTICS_DEFAULT
log = logging.getLogger()
log.setLevel('DEBUG')
handler = logging.StreamHandler()
handler.setFormatter(logging.Formatter("%(asctime)s [%(levelname)s] %(name)s: %(message)s"))
log.addHandler(handler)
from dse.cluster import Cluster
import datetime
cluster = Cluster()
session = cluster.connect()
graph_name = "graph_name_poc_io"
session.execute_graph('system.graph(name).ifNotExists().create()', {'name': graph_name})
profiles = cluster.profile_manager.profiles
profiles[EXEC_PROFILE_GRAPH_DEFAULT].request_timeout = 60
profiles[EXEC_PROFILE_GRAPH_DEFAULT].graph_options.graph_name = graph_name
profiles[EXEC_PROFILE_GRAPH_ANALYTICS_DEFAULT].graph_options.graph_name = graph_name
#session.execute_graph('schema.clear()')
ALLOW_SCANS = "schema.config().option('graph.allow_scan').set('true')"
MAKE_NON_STRICT = "schema.config().option('graph.schema_mode').set('development')"
session.execute_graph(MAKE_NON_STRICT)
session.execute_graph(ALLOW_SCANS)
g = DseGraph().traversal_source(session, graph_name)
key = "time1"
vertex_label = "time1"
property_name= "time1" + "value"
traversal = g.addV("poc_io").property(property_name, datetime.time(12, 6, 12, 444))
traversal.toList()
for i in g.V().valueMap():
print(i)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment