2017-06-26 18 views
1

'を始め' 私はpy2neoバージョン3を使用して、次のエラーを取得しています:py2neo:はAttributeError: '関数' オブジェクトが何の属性を持っていない

> GET http://localhost:7474/db/data/ 
< 200 OK [795] 
Traceback (most recent call last): 
    File "run_snomed_upload.py", line 63, in <module> 
    sp = SnomedConceptProcessor() 
    File "/home/arron/Downloads/Snomed/neo4j/snomed_concept_processor.py", line 18, in __init__ 
    tx = self.graph.run.begin()          # changed .cyhper to .run 
AttributeError: 'function' object has no attribute 'begin' 

コード:

import re 
from string import Template 
from py2neo import Graph 
from py2neo import watch 
from worker.abstract_item_processor import BaseItemProcessor 



class SnomedConceptProcessor(BaseItemProcessor): 
    statement = Template("CREATE (c:Concept:FSA:$label {conceptId: \"$id\", term: \"$term\", descType: $descType});") 
    create_index_concept_id = "CREATE INDEX ON :Concept(conceptId)" 
    create_index_term = "CREATE INDEX ON :Concept(term)" 

    def __init__(self): 
     watch("httpstream") 
     self.graph = Graph(super().graph_url) 
     tx = self.graph.run.begin() 

をIあなたが私が行ったことを見ることができる.cypher.runに変更する必要があると読んだことがあります。私はpy2neo v2にダウングレードする必要がありますかもしそうなら、私はどのように並列パッケージを持たないでそれを行うのですか?

答えて

1

Cypher.run()は、Cypher文とパラメータの辞書をパラメータとして受け取る関数です。関数としてもも呼び出しておらず、パラメータを提供していません。

The docs

は言う:

Note: The previous version of py2neo allowed Cypher execution through Graph.cypher.execute(). This facility is now instead accessible via Graph.run() and returns a lazily-evaluated Cursor rather than an eagerly-evaluated RecordList.

同じドキュメントがの使用例を示します。

>>> from py2neo import Graph 
>>> graph = Graph(password="excalibur") 
>>> graph.run("MATCH (a:Person) RETURN a.name, a.born LIMIT 4").data() 
[{'a.born': 1964, 'a.name': 'Keanu Reeves'}, 
{'a.born': 1967, 'a.name': 'Carrie-Anne Moss'}, 
{'a.born': 1961, 'a.name': 'Laurence Fishburne'}, 
{'a.born': 1960, 'a.name': 'Hugo Weaving'}] 
関連する問題