graflo.cli.install_tigergraph_queries¶
Install GSQL queries from a directory into TigerGraph.
Reads .gsql files, rewrites the graph name in each query header (the token between
) FOR GRAPH and {), uploads the definition, then runs INSTALL QUERY.
Files may use any graph name or placeholder in the header, for example::
CREATE OR REPLACE DISTRIBUTED QUERY myQuery() FOR GRAPH accounting { ... }
Connection settings are loaded from environment variables via
:class:~graflo.db.TigergraphConfig (default TIGERGRAPH_*; use --prefix for
qualified names such as USER_TIGERGRAPH_URI).
Example
$ export TIGERGRAPH_URI=http://localhost:14240 $ export TIGERGRAPH_USERNAME=tigergraph $ export TIGERGRAPH_PASSWORD=tigergraph $ export TIGERGRAPH_DATABASE=my_graph $ uv run install_tigergraph_queries --queries-dir ./queries/
install_queries_from_directory(conn, *, graph_name, queries_dir, pattern='*.gsql')
¶
Upload and install every GSQL file matching pattern under queries_dir.
Source code in graflo/cli/install_tigergraph_queries.py
install_tigergraph_queries(queries_dir, graph, prefix, pattern, ssl_verify, verbose)
¶
Upload and install GSQL queries from a directory into TigerGraph.
Source code in graflo/cli/install_tigergraph_queries.py
prepare_gsql_content(content, graph_name)
¶
Rewrite query header graph name(s) before upload.
Returns prepared content and the previous header graph name(s).
Source code in graflo/cli/install_tigergraph_queries.py
query_name_from_gsql(content, *, fallback=None)
¶
Return the query name from a GSQL CREATE [OR REPLACE] [DISTRIBUTED] QUERY.
Source code in graflo/cli/install_tigergraph_queries.py
substitute_for_graph_header(content, graph_name)
¶
Replace graph name(s) in ) FOR GRAPH <name> { header clause(s).
Returns the updated content and the previous name(s) stripped from the header.