dongyan2445 2015-11-17 23:33
浏览 84
已采纳

如何在Postgres后端上使用Cayley?

As per this Github issue, the Postgres backend feature for the Cayley graph database is implemented. However, currently there aren't examples in the docs, and I couldn't figure it out by reading the code. Could someone help?

Edit

To start playing with Cayley, we can load data that comes with the source with the following command:

./cayley load --config=cayley.cfg.overview --quads=data/30kmoviedata.nq.gz

I tried two variations of the cayley.cfg.overview file:

{
    "database": "sql",
    "db_path": "localhost:5432",
    "read_only": false
}

and

{
    "database": "sql",
    "db_path": "/var/lib/postgresql/9.4/main/cayley",
    "read_only": false
}

The first one being analogous to the one used with mongo (5432 being the port at which the postgres server is listening). As for the second one, I have no clue of what I'm doing there :D.

In any case, when I use the ./cayley load --config=cayley.cfg.overview --quads=data/30kmoviedata.nq.gz command I get the following error (varying only the value of db_path):

Couldn't open database at localhost:5432: 
&errors.errorString{s:"missing \"=\" after \"127.0.0.1:5432\" in connection 
info string\""}
E1117 21:09:18.300033 16689 cayley.go:277] missing "=" after "localhost:5432" 
in connection info string"
  • 写回答

1条回答 默认 最新

  • douzou7012 2015-11-18 02:09
    关注

    It looks like Cayley is using lib/pq under the covers. lib/pq connection strings look something like this: "user=pqgotest dbname=pqgotest sslmode=verify-full" or "postgres://pqgotest:password@localhost/pqgotest?sslmode=verify-full" For full details see the lib/pq documentation at godoc.org.

    (You can see where the sql.Open call is made in cayley/graph/sql/quadstore.go connectSQLTables.)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 win10权限管理,限制普通用户使用删除功能
  • ¥15 minnio内存占用过大,内存没被回收(Windows环境)
  • ¥65 抖音咸鱼付款链接转码支付宝
  • ¥15 ubuntu22.04上安装ursim-3.15.8.106339遇到的问题
  • ¥15 求螺旋焊缝的图像处理
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?
  • ¥15 网络通信安全解决方案
  • ¥50 yalmip+Gurobi
  • ¥20 win10修改放大文本以及缩放与布局后蓝屏无法正常进入桌面