Daniel Komisar
12/21/2021, 10:13 PM_has_key
. I’ve tried using _contains
with no luck, although I’m not sure if that’s the right one either, or if this is even possible. Thanks!Anna Geller
query ($param_value: jsonb) {
flow_run(
where: {_and: [{flow_id: {_eq: "eb45ed0a-a76c-445b-b0b8-1fdc05c1f54c"}},
{parameters: {_eq: $param_value}}]}
) {
name
state
end_time
start_time
parameters
}
}
Query variables is where you put the parameter values you search for:
{
"param_value": {
"x": 1
}
}
here: x is the parameter name and 1 is the parameter value. This allows us to search for flow runs that have been triggered with this value of parameter “x”.
Here is an example output:Daniel Komisar
12/21/2021, 11:09 PMDaniel Komisar
12/21/2021, 11:52 PM_eq
my understanding is that this is matching against the entire parameters dict.
What I was hoping to do is something like this:
query {
flow_run(where: { parameters: { _contains: { upload: True }}}) {
state
state_message
}
}
which would return any flows that had the parameters upload
key set to True
and anything else in any other keys.Anna Geller
from prefect import Client
client = Client()
query = """
query ($param_value: jsonb) {
flow_run(
where: {_and: [{flow_id: {_eq: "eb45ed0a-a76c-445b-b0b8-1fdc05c1f54c"}},
{parameters: {_eq: $param_value}}]}
) {
name
state
end_time
start_time
parameters
}
}
"""
response = client.graphql(query, variables=dict(param_value=dict(x=1)))
print(response)
Then, the response object will give you a dictionary-like GraphQLResult object you can filter further in your Python code