Schema Functions
The functions in this page retrieve information about the graph schema.
All functions in this module are called as methods on a TigerGraphConnection
object.
getSchema()
getSchema(udts: bool = True, force: bool = False) → dict
Retrieves the schema metadata (of all vertex and edge type and, if not disabled, the User-Defined Type details) of the graph.
Parameters:
-
udts
: IfTrue
, the output includes User-Defined Types in the schema details. -
force
: IfTrue
, retrieves the schema metadata again, otherwise returns a cached copy of the schema metadata (if they were already fetched previously).
Returns:
The schema metadata.
Endpoint:
-
GET /gsqlserver/gsql/schema
(In TigerGraph version 3.x) See Show graph schema metadata -
GET /gsql/v1/schema/graphs/{graph_name}
(In TigerGraph version 4.x)
upsertData()
upsertData(data: Union[str, object], atomic: bool = False, ackAll: bool = False, newVertexOnly: bool = False, vertexMustExist: bool = False, updateVertexOnly: bool = False) → dict
Upserts data (vertices and edges) from a JSON file or a file with equivalent object structure.
Parameters:
-
data
: The data of vertex and edge instances, in a specific format. -
atomic
: The request is an atomic transaction. An atomic transaction means that updates to the database contained in the request are all-or-nothing: either all changes are successful, or none are successful. -
ackAll
: IfTrue
, the request will return after all GPE instances have acknowledged the POST. Otherwise, the request will return immediately after RESTPP processes the POST. -
newVertexOnly
: IfTrue
, the request will only insert new vertices and not update existing ones. -
vertexMustExist
: IfTrue
, the request will only insert an edge if both theFROM
andTO
vertices of the edge already exist. If the value isFalse
, the request will always insert new edges and create the necessary vertices with default values for their attributes. Note that this parameter does not affect vertices. -
updateVertexOnly
: IfTrue
, the request will only update existing vertices and not insert new vertices.
Returns:
The result of upsert (number of vertices and edges accepted/upserted).
Endpoint:
-
POST /graph/{graph_name}
See Upsert data to graph
getEndpoints()
getEndpoints(builtin: bool = False, dynamic: bool = False, static: bool = False) → dict
Lists the REST++ endpoints and their parameters.
Parameters:
-
builtin
: List the TigerGraph-provided REST++ endpoints. -
dynamic
: List endpoints for user-installed queries. -
static
: List static endpoints.
If none of the above arguments are specified, all endpoints are listed.
Endpoint:
-
GET /endpoints/{graph_name}
See List all endpoints