How to insert a vertex
wilsonyou opened this issue · comments
I read your documents but could locate the syntax for inserting one vertex or edge into Tigergraph.
@wilsonyou A couple questions to help me better understand. Are you looking to "create" a vertex or edge as in the schema. Or, (which it sound like) are you trying to add NEW data into a Vertex and Edge.
Assuming you have your schema built already:
From CSV or JSON
Via terminal, computer, or service (note: will need a loading job):
https://docs.tigergraph.com/dev/restpp-api/built-in-endpoints#post-ddl-graph_name-run-a-loading-job
Via Graph Studio (note: you will need to have your schema built):
- Map Data https://docs.tigergraph.com/ui/graphstudio/map-data-to-graph
- Load Data https://docs.tigergraph.com/ui/graphstudio/load-data
Direct Data Load (non File)
Via terminal, computer, or service
https://docs.tigergraph.com/dev/restpp-api/built-in-endpoints#post-builtins-graph_name
Via Graph Studio
- Once in Graph Studio > Click "Explore Graph"
- On the top you should see some icons. Use the "+" sign to add a new vertex & "->" to add a new edge
Or are you @wilsonyou trying to UPSERT data?
Or are you @wilsonyou trying to UPSERT data?
Thank your for your help @HerkTG .
What I want to know is whether there is any statement in your gsql language that could be used to insert a vertex in a vertex type.
For example, if I create a vertex type named directors, then I want to add one director vertex into the directors type. Do you support this operation on command line?
Right. So you have a VERTEX called "Director" and lets say you want to INSERT "Michael Bay" into the VERTEX labeled "Director".
If you are using the terminal you can run a CURL command to POST data one of the built-in REST endpoints. Please read this very carefully https://docs.tigergraph.com/dev/restpp-api/built-in-endpoints#post-graph-graph_name-upsert-the-given-data
You can also use the tool called Giraffle which creates a GSQL prompt directly in your terminal allowing you to write GSQL commands on your local desktop. I've outlined how to get Giraffle up and running in this blog: https://medium.com/@jon.herke/getting-started-with-giraffle-on-tigergraph-cloud-970ead739943
If you haven't provisioned a TigerGraph server before use this blog to get started: https://medium.com/@jon.herke/deploy-a-graph-database-in-3-steps-no-code-need-d903bd062dae
Hope this helps!
Also, if you want to connect with the Community:
Community Form: https://www.reddit.com/r/tigergraph/
Community Chat: https://discord.gg/F2c9b9v
Thank you very much for your kind help @HerkTG