AttributeError: 'Graph' object has no attribute 'cypher' in migration of data from Postgress to Neo4
2017-04-04 11:27
316 查看
import psycopg2 from py2neo import authenticate, Graph authenticate("localhost:7474", "neo4j", "password") n4j_graph = Graph("http://localhost:7474/db/data/") try: conn=psycopg2.connect("dbname='db_name' user='user' password='password'") except: print "good bye" cur = conn.cursor() try: cur.execute("""SELECT * from table_name""") except: print "not found" rows = cur.fetchall() for row in rows: username = row[4] email = row[7] s = '''MERGE (u:User { username: "%(username)s"}) MERGE (e:Email { email: "%(email)s"}) CREATE UNIQUE (u)-[:BELONGS_TO]->(e)''' %{"username": username, "email": email} print s n4j_graph.cypher.execute(s)
运行过程中发现错误如下:
AttributeError: 'Graph' object has no attribute 'cypher'
一番查找后才明白过来是我的pydev安装的版本不对,一次先卸载以前安装的版本,在安装我们需要使用的版本
pip uninstall py2neo pip install py2neo==2.0.8
相关文章推荐
- Importing theano: AttributeError: 'module' object has no attribute 'find_graphviz'
- output_node = graph_pb2.NodeDef() AttributeError: 'module' object has no attribute 'NodeDef'
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
- python大坑:AttributeError: 'module' object has no attribute 'Workbook'
- Scrapy安装报错:AttributeError: 'module' object has no attribute 'OP_NO_TLSv1_1'解决办法
- Python AttributeError: ‘module’ object has no attribute ‘A’
- 用python爬github上星级排名前列的项目报错AttributeError: 'NoneType' object has no attribute 'decode'
- AttributeError: 'module' object has no attribute 'text_format'
- Python3下错误AttributeError: ‘dict’ object has no attribute’iteritems‘的分析与解决
- python 提示错误AttributeError: type object 'str' has no attribute '_name_'
- tensorflow 报错 AttributeError: 'module' object has no attribute 'computation'
- Python 保存数组至.mat文件,报错:AttributeError: 'numpy.ndarray' object has no attribute 'items'
- Python AttributeError: 'module' object has no attribute xxxx
- 出现错误如下:AttributeError: 'module' object has no attribute 'SSL_ST_INIT'
- Scrapy报错Error: 'module' object has no attribute 'OP_SINGLE_ECDH_USE'
- AttributeError: module object has no attribute “Series”. Code works in Python
- RabbitVCS(0.14.2)不显示右键设置(settings)菜单,AttributeError: 'gtk.VBox' object has no attribute 'set_visible
- tensorflow AttributeError: 'module' object has no attribute 'cpu_count'
- Flask:报AttributeError: 'NoneType' object has no attribute 'metadata'错误