Thread
#prefect-community
    Aiden Price

    Aiden Price

    1 year ago
    Hi everyone! I have a GraphQL question as well. I'm trying to get and set the default parameters for a flow_group, can anyone help me?
    I have a
    query
    like this;
    query($path: String!) {
      flow {
        id
        name
        flow_group_id
        flow_group {
          id
          name
          default_parameters(path: $path)
        }
      }
    }
    But I get Interval server errors, "Cannot return null for non-nullable field flow.id." Which I assume means that I've made a mistake in the query.
    I'm really just trying to get all the default parameters for the flow group. And I'll later on try and set some of them in a Mutation
    And when I try to set default parameters in a Mutation like this one;
    mutation($flow_group_id: UUID!, $params: JSON!) {
        set_flow_group_default_parameters(
            input: {
                flow_group_id: $flow_group_id,
                parameters: $params
            }
        ) {
            success
            error
        }
    }
    With parameters like this;
    {
      "flow_group_id": "e214d16b-ca58-453c-b67f-xxxxxxxxxxxxx",
      "params": "{\"site_timezone\": \"Australia/Queensland\"}"
    }
    I get an error that says
    value is not a valid dict (type=type_error.dict)
    Kevin Kho

    Kevin Kho

    1 year ago
    Hey @Aiden Price, what are you trying to do with the path in the first query? Isn’t this enough to get the parameters?
    query {
      flow {
        id
        name
        flow_group {
          id
          name
          default_parameters
        }
      }
    }
    Or is it that you want the path specifically?
    Aiden Price

    Aiden Price

    1 year ago
    I tried to just get the default parameters like you suggested but I just get an empty object back for all my flows
    {}
    when I was expecting that all of them would have at least one
    Kevin Kho

    Kevin Kho

    1 year ago
    Ah ok will test this
    Aiden Price

    Aiden Price

    1 year ago
    Thanks
    Kevin Kho

    Kevin Kho

    1 year ago
    So I think there’s two things here. First are the default parameters that are set in the code. These can be found under
    flow -> parameters
    . In the UI though, you can set overrides to these and those will populate
    flow_group -> default_parameters
    So maybe you’re looking for something like this?
    query {
      flow (where: {name: {_eq: "docker_example"}}){
        id
        name
        parameters
        flow_group {
          id
          name
          default_parameters
        }
      }
    }
    And you’ll find them under the parameters block
    Aiden Price

    Aiden Price

    1 year ago
    So the default parameters are under the
    flow
    not the
    flow_group
    ? because I still get an empty object for the
    default_parameters
    And I get multiple copies of the
    flow
    presumably because of all the versions. I assumed that I could change the parameters for the
    flow_group
    and then I would change the defaults for any new versions.
    Kevin Kho

    Kevin Kho

    1 year ago
    Did you set values on this page? These overrides are the one that would apply on the flow group level.
    Yes default parameters set in code are under flow. The ones set of the
    flow_group
    are treated as overrides
    Aiden Price

    Aiden Price

    1 year ago
    Oh okay, thank you for clearing that up. Can you also help with setting them with JSON values in the Mutation? I still get this error;
    value is not a valid dict (type=type_error.dict)
    when I try to post the mutation.
    Bouke Krom

    Bouke Krom

    1 year ago
    Did you try not escaping the quotes in your variables? ie
    {
      "flow_group_id": "e214d16b-xxxxxxxxxxxxx",
      "params": {
        "site_timezone": "Australia/Queensland"
      }
    }
    GraphiQL will give you warnings about expecting a JSON but the query might work.
    Aiden Price

    Aiden Price

    1 year ago
    Hey that did work, weird. Thank you @Bouke Krom
    Bouke Krom

    Bouke Krom

    1 year ago
    Happy to help! GraphQL takes some getting used to, I know from experience 😉