mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-04-26 00:46:22 +02:00
Feature/graphql table query (#486)
* Tech spec * Object query service for Cassandra * Gateway support for objects-query * GraphQL query utility * Filters, ordering
This commit is contained in:
parent
38826c7de1
commit
672e358b2f
20 changed files with 3133 additions and 3 deletions
|
|
@ -383,3 +383,46 @@ class FlowInstance:
|
|||
input
|
||||
)
|
||||
|
||||
def objects_query(
|
||||
self, query, user="trustgraph", collection="default",
|
||||
variables=None, operation_name=None
|
||||
):
|
||||
|
||||
# The input consists of a GraphQL query and optional variables
|
||||
input = {
|
||||
"query": query,
|
||||
"user": user,
|
||||
"collection": collection,
|
||||
}
|
||||
|
||||
if variables:
|
||||
input["variables"] = variables
|
||||
|
||||
if operation_name:
|
||||
input["operation_name"] = operation_name
|
||||
|
||||
response = self.request(
|
||||
"service/objects",
|
||||
input
|
||||
)
|
||||
|
||||
# Check for system-level error
|
||||
if "error" in response and response["error"]:
|
||||
error_type = response["error"].get("type", "unknown")
|
||||
error_message = response["error"].get("message", "Unknown error")
|
||||
raise ProtocolException(f"{error_type}: {error_message}")
|
||||
|
||||
# Return the GraphQL response structure
|
||||
result = {}
|
||||
|
||||
if "data" in response:
|
||||
result["data"] = response["data"]
|
||||
|
||||
if "errors" in response and response["errors"]:
|
||||
result["errors"] = response["errors"]
|
||||
|
||||
if "extensions" in response and response["extensions"]:
|
||||
result["extensions"] = response["extensions"]
|
||||
|
||||
return result
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue