TigerGraph#

class langchain_community.graphs.tigergraph_graph.TigerGraph(conn: Any)[source]#

TigerGraph wrapper for graph operations.

Security note: Make sure that the database connection uses credentials

that are narrowly-scoped to only include necessary permissions. Failure to do so may result in data corruption or loss, since the calling code may attempt commands that would result in deletion, mutation of data if appropriately prompted or reading sensitive data if such data is present in the database. The best way to guard against such negative outcomes is to (as appropriate) limit the permissions granted to the credentials used with this tool.

See https://python.langchain.com/docs/security for more information.

Create a new TigerGraph graph wrapper instance.

Attributes

conn

get_structured_schema

Return the schema of the Graph database

schema

Methods

__init__(conn)

Create a new TigerGraph graph wrapper instance.

add_graph_documents(graph_documents[,Β ...])

Take GraphDocument as input as uses it to construct a graph.

generate_schema()

Generates the schema of the TigerGraph Database and returns it User can specify a sample_ratio (0 to 1) to determine the ratio of documents/edges used (in relation to the Collection size) to render each Collection Schema.

get_schema()

Return the schema of the Graph database

query(query)

Query the TigerGraph database.

refresh_schema()

Refresh the graph schema information.

register_query(function_header,Β description,Β ...)

Wrapper function to register a custom GSQL query to the TigerGraph NLQS.

set_connection(conn)

set_schema([schema])

Set the schema of the TigerGraph Database.

Parameters:

conn (Any) –

__init__(conn: Any) β†’ None[source]#

Create a new TigerGraph graph wrapper instance.

Parameters:

conn (Any) –

Return type:

None

abstract add_graph_documents(graph_documents: List[GraphDocument], include_source: bool = False) β†’ None#

Take GraphDocument as input as uses it to construct a graph.

Parameters:
  • graph_documents (List[GraphDocument]) –

  • include_source (bool) –

Return type:

None

generate_schema() β†’ Dict[str, List[Dict[str, Any]]][source]#

Generates the schema of the TigerGraph Database and returns it User can specify a sample_ratio (0 to 1) to determine the ratio of documents/edges used (in relation to the Collection size) to render each Collection Schema.

Return type:

Dict[str, List[Dict[str, Any]]]

get_schema() β†’ str[source]#

Return the schema of the Graph database

Return type:

str

query(query: str) β†’ Dict[str, Any][source]#

Query the TigerGraph database.

Parameters:

query (str) –

Return type:

Dict[str, Any]

refresh_schema()[source]#

Refresh the graph schema information.

register_query(function_header: str, description: str, docstring: str, param_types: dict = {}) β†’ List[str][source]#

Wrapper function to register a custom GSQL query to the TigerGraph NLQS.

Parameters:
  • function_header (str) –

  • description (str) –

  • docstring (str) –

  • param_types (dict) –

Return type:

List[str]

set_connection(conn: Any) β†’ None[source]#
Parameters:

conn (Any) –

Return type:

None

set_schema(schema: Dict[str, Any] | None = None) β†’ None[source]#

Set the schema of the TigerGraph Database. Auto-generates Schema if schema is None.

Parameters:

schema (Dict[str, Any] | None) –

Return type:

None

Examples using TigerGraph