langchain_community.graphs.tigergraph_graph.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

Returns 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()

Returns the schema of the Graph database

query(query)

Query the TigerGraph database.

refresh_schema()

Refreshes 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]¶

Returns 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]¶

Refreshes 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: Optional[Dict[str, Any]] = None) None[source]¶

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

Parameters

schema (Optional[Dict[str, Any]]) –

Return type

None