tigergraph / ecosys

TigerGraph Ecosystem

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How can I use spark to read all edges from tigergraph?

wengzhenjie opened this issue · comments

commented

Hi, everyone! I have a problem to use tg-jdbc-driver. The example is for specific source. However, I want to read all edges without specific source.

// read edge
val jdbcDF2 = spark.read.format("jdbc").options(
  Map(
    "driver" -> "com.tigergraph.jdbc.Driver",
    "url" -> "jdbc:tg:http://127.0.0.1:14240",
    "username" -> "tigergraph",
    "password" -> "tigergraph",
    "graph" -> "gsql_demo", // graph name
    "dbtable" -> "edge Linkto", // edge type
    "limit" -> "10", // number of edges to retrieve
    "source" -> "3", // source vertex id
    "debug" -> "0")).load()

How can I change this example to fulfill my needs.
Many thanks!

commented

I try to invoke interpreted queries. This solve my problem!

interpreted() INTERPRET QUERY () FOR GRAPH social {
     SetAccum<Edge> @@EdgeSet;vs={person.*};
     ans=SELECT t FROM vs-(friendship:e)->person:t 
             ACCUM @@EdgeSet+=e;
     PRINT @@EdgeSet;
}

Sorry to disturb everyone.