当前位置: 首页>>代码示例>>Python>>正文


Python Store.commit方法代码示例

本文整理汇总了Python中store.Store.commit方法的典型用法代码示例。如果您正苦于以下问题:Python Store.commit方法的具体用法?Python Store.commit怎么用?Python Store.commit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在store.Store的用法示例。


在下文中一共展示了Store.commit方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setup

# 需要导入模块: from store import Store [as 别名]
# 或者: from store.Store import commit [as 别名]
 def setup(dbhost='localhost', dbport=7474, dburl=None, querypath=None):
     '''
     Program to set up for running our REST server.
     We do these things:
         - Attach to the database
         - Initialize our type objects so things like ClientQuery will work...
         - Load the queries into the database from flat files
             Not sure if doing this here makes the best sense, but it
             works, and currently we're the only one who cares about them
             so it seems reasonable -- at the moment ;-)
             Also we're most likely to iterate changing on those relating to the
             REST server, so fixing them just by restarting the REST server seems
             to make a lot of sense (at the moment)
         - Remember the set of queries in the 'allqueries' hash table
     '''
     if dburl is None:
         dburl = ('http://%s:%d/db/data/' % (dbhost, dbport))
     print >> sys.stderr, 'CREATING Graph("%s")' % dburl
     neodb = neo4j.Graph(dburl)
     qstore = Store(neodb, None, None)
     print GraphNode.classmap
     for classname in GraphNode.classmap:
         GraphNode.initclasstypeobj(qstore, classname)
     print "LOADING TREE!"
     if querypath is None:
         querypath = "/home/alanr/monitor/src/queries"
     queries = ClientQuery.load_tree(qstore, querypath)
     for q in queries:
         allqueries[q.queryname] = q
     qstore.commit()
     for q in allqueries:
         allqueries[q].bind_store(qstore)
开发者ID:Alan-R,项目名称:assimilation-persistent-events,代码行数:34,代码来源:hello.py

示例2: import_rutez

# 需要导入模块: from store import Store [as 别名]
# 或者: from store.Store import commit [as 别名]
def import_rutez():
    store = Store()
    store.ensure_thesaurus('rutez', u'РуТез')
    store.select('rutez')

    conn = sqlite3.connect('/home/petr/ownCloud/projects/rutez/rutez.db')
    c = conn.cursor()
    memd = {}
    c.execute("""select w1.name, w2.name, rel.name from rel
                 join sinset w1 on w1.id = rel.id
                 join sinset w2 on w2.id = rel.link
              """)
    store.set_autocommit(False)
    for row in c.fetchall():
        store.ensure_link(row[0], row[1], row[2])
        #print row[0], row[1], row[2]

    c.execute("""select s.name, w.name from sinset s
                 join word w on w.id = s.id
              """)
    for row in c.fetchall():
        store.ensure_word(row[0], row[1])

    store.commit()
开发者ID:pitcons,项目名称:amarak,代码行数:26,代码来源:rutez.py

示例3: Neo4jCreds

# 需要导入模块: from store import Store [as 别名]
# 或者: from store.Store import commit [as 别名]
    Neo4jCreds().authenticate()
    neodb = neo4j.Graph()
    neodb.delete_all()

    umap  = {'ClientQuery': True}
    ckmap = {'ClientQuery': {'index': 'ClientQuery', 'kattr':'queryname', 'value':'None'}}

    qstore = Store(neodb, uniqueindexmap=umap, classkeymap=ckmap)
    for classname in GraphNode.classmap:
        GraphNode.initclasstypeobj(qstore, classname)

    print "LOADING TREE!"

    queries = ClientQuery.load_tree(qstore, "%s/../queries" % (os.path.dirname(sys.argv[0])))
    qlist = [q for q in queries]
    qstore.commit()
    print "%d node TREE LOADED!" % len(qlist)
    qe2 = qstore.load_or_create(ClientQuery, queryname='list')
    qe2.bind_store(qstore)
    testresult = ''
    for s in qe2.execute(None, idsonly=False, expandJSON=True):
        testresult += s
    print 'RESULT', testresult
    # Test out a command line query
    for s in qe2.cmdline_exec(None):
        if re.match(s, '[	 ]unknown$'):
            raise RuntimeError('Search result contains unknown: %s' % s)
        print s

    print "All done!"
开发者ID:h4ck3rm1k3,项目名称:assimilation-official,代码行数:32,代码来源:query.py


注:本文中的store.Store.commit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。