Google Big Query - Query Project

Hi n8n community!

Following the release of the Google Big Query node (hooray!) I would like to request a feature that I think could be very useful, with a wide variety of use cases.

This feature is the jobs.query Method in their API documentation.

This would allow for the querying of large tables with SQL, therefore reducing the amount of output or enriching it, and therefore (if my understanding is correct) the cost of Big Query.

We had managed to make this work with an HTTP request, and the following set up, I hope this helps!

{
  "nodes": [
    {
      "parameters": {
        "authentication": "oAuth2",
        "requestMethod": "POST",
        "url": "=https://bigquery.googleapis.com/bigquery/v2/projects/[project_name]/queries",
        "options": {},
        "bodyParametersUi": {
          "parameter": [
            {
              "name": "query",
              "value": "=SELECT act.campaign_id FROM [project_name] as act\nLEFT JOIN [project_name] as camp\nON act.campaign_id = camp.campaign_id\nWHERE camp.campaign_id IS NULL\nGROUP BY act.campaign_id"
            },
            {
              "name": "useLegacySql",
              "value": "false"
            }
          ]
        },
        "headerParametersUi": {
          "parameter": [
            {
              "name": "Accept",
              "value": "application/json"
            },
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        },
        "queryParametersUi": {
          "parameter": [
            {
              "name": "key",
              "value": "[KEY]"
            }
          ]
        }
      },
      "name": "Get campaigns",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        -200,
        200
      ],
      "notesInFlow": true,
      "credentials": {
        "oAuth2Api": "Google Big Query OAuth 2"
      },
      "notes": "- group by campaign\n- left join + null\n- add remaining"
    }
  ],
  "connections": {}
}

Thanks :slight_smile:

@maximpoulsen glad that you liked the node and thanks for sharing.