-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
demos/guru_scripts/docker/tutorial/4.x/cypher/load-data.cypher
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
USE GRAPH financialGraph | ||
|
||
DROP JOB load_s3_file | ||
DROP DATA_SOURCE s3_data_source_0 | ||
|
||
#define a data source from s3 | ||
CREATE DATA_SOURCE s3_data_source_0 = "{\"access.key\":\"none\",\"secret.key\":\"none\",\"file.reader.settings.fs.s3a.aws.credentials.provider\": \"org.apache.hadoop.fs.s3a.AnonymousAWSCredentialsProvider\",\"type\":\"s3\"}" FOR GRAPH financialGraph | ||
|
||
|
||
CREATE LOADING JOB load_s3_file { | ||
// define the s3 location of the source files; each file path is assigned a filename variable. | ||
DEFINE FILENAME account="""$s3_data_source_0:{"file.uris":"s3a://tigergraph-example-data/ecosys/account.csv"}"""; | ||
DEFINE FILENAME phone="""$s3_data_source_0:{"file.uris":"s3a://tigergraph-example-data/ecosys/phone.csv"}"""; | ||
DEFINE FILENAME city="""$s3_data_source_0:{"file.uris":"s3a://tigergraph-example-data/ecosys/city.csv"}"""; | ||
DEFINE FILENAME hasPhone="""$s3_data_source_0:{"file.uris":"s3a://tigergraph-example-data/ecosys/hasPhone.csv"}"""; | ||
DEFINE FILENAME locatedIn="""$s3_data_source_0:{"file.uris":"s3a://tigergraph-example-data/ecosys/locate.csv"}"""; | ||
DEFINE FILENAME transferdata="""$s3_data_source_0:{"file.uris":"s3a://tigergraph-example-data/ecosys/transfer.csv"}"""; | ||
//define the mapping from the source file to the target graph element type. The mapping is specified by VALUES clause. | ||
LOAD account TO VERTEX Account VALUES ($"name", gsql_to_bool(gsql_trim($"isBlocked"))) USING header="true", separator=","; | ||
LOAD phone TO VERTEX Phone VALUES ($"number", gsql_to_bool(gsql_trim($"isBlocked"))) USING header="true", separator=","; | ||
LOAD city TO VERTEX City VALUES ($"name") USING header="true", separator=","; | ||
LOAD hasPhone TO Edge hasPhone VALUES ($"accnt", gsql_trim($"phone")) USING header="true", separator=","; | ||
LOAD locatedIn TO Edge isLocatedIn VALUES ($"accnt", gsql_trim($"city")) USING header="true", separator=","; | ||
LOAD transferdata TO Edge transfer VALUES ($"src", $"tgt", $"date", $"amount") USING header="true", separator=","; | ||
} | ||
|
||
run loading job load_s3_file |