{
  "_exportDate": "2021-10-19T17:42:26.582Z",
  "_type": "flow",
  "applicationId": "612ee42a9882c300062bedd7",
  "customNodeVersions": [
  ],
  "customNodes": [
  ],
  "description": "",
  "enabled": true,
  "flowClass": "cloud",
  "globals": [
  ],
  "id": "6149eb3a1e59700006c86c05",
  "name": "Send Data to BigQuery",
  "nodes": [
    {
      "config": {
        "max": 100,
        "min": 0,
        "resultPath": "working.temperature"
      },
      "id": "rWYkDRKtg6",
      "meta": {
        "category": "logic",
        "description": "",
        "label": "Random Number",
        "name": "random-number",
        "x": 220,
        "y": 120
      },
      "outputIds": [
        [
          "wjmiV2YHit"
        ]
      ],
      "type": "RandomNumberNode"
    },
    {
      "config": {
        "max": 100,
        "min": 0,
        "resultPath": "working.pressure"
      },
      "id": "wjmiV2YHit",
      "meta": {
        "category": "logic",
        "description": "",
        "label": "Random Number",
        "name": "random-number",
        "x": 220,
        "y": 220
      },
      "outputIds": [
        [
          "vFOGWYjtWQ"
        ]
      ],
      "type": "RandomNumberNode"
    },
    {
      "config": {
        "max": 100,
        "min": 0,
        "resultPath": "working.humidity"
      },
      "id": "vFOGWYjtWQ",
      "meta": {
        "category": "logic",
        "description": "",
        "label": "Random Number",
        "name": "random-number",
        "x": 220,
        "y": 320
      },
      "outputIds": [
        [
          "ggBIoqIqmU"
        ]
      ],
      "type": "RandomNumberNode"
    },
    {
      "config": {
        "action": "insertAll",
        "datasetId": "Your Dataset ID",
        "jwtDataMethod": "jsonTemplate",
        "jwtJsonTemplate": "{\n  \"put-your\": \"whole key here\"\n}",
        "resource": "tabledata",
        "resultPath": "working.gcpResponse",
        "tableData": "\n{\n  \"rows\": [\n    {\n      \"json\": {\n        \"deviceId\": \"{{defaultTo deviceId 'myDeviceId'}}\",\n        \"attr_temperature\": {{defaultTo data.temperature working.temperature}},\n        \"attr_pressure\": {{defaultTo data.pressure working.pressure}},\n        \"attr_humidity\": {{defaultTo data.humidity working.humidity}},\n        \"tag_deviceType\": \"{{defaultTo device.tags.type.[0] 'test-deviceType'}}\",\n        \"tag_deviceSerialNum\": \"{{defaultTo device.tags.serial.[0] '1234567890'}}\",\n        \"timestamp\": \"{{formatDate time 'YYYY-MM-DDTHH:mm:ss.SSSZ'}}\"\n      }\n    }\n  ]\n}",
        "tableId": "Your Table ID"
      },
      "id": "ggBIoqIqmU",
      "meta": {
        "category": "data",
        "description": "",
        "label": "GCP: BigQuery",
        "name": "google-bigquery",
        "x": 20,
        "y": 520
      },
      "outputIds": [
        [
          "ZwyMlPY3ab"
        ]
      ],
      "type": "GoogleBigQueryNode"
    },
    {
      "config": {
        "message": "",
        "property": ""
      },
      "id": "ZwyMlPY3ab",
      "meta": {
        "category": "output",
        "description": "",
        "label": "Debug",
        "name": "debug",
        "x": 20,
        "y": 620
      },
      "outputIds": [
      ],
      "type": "DebugNode"
    },
    {
      "config": {
        "action": "query",
        "jwtDataMethod": "jsonTemplate",
        "jwtJsonTemplate": "{\n  \"put-your\": \"whole key here\"\n}",
        "queryRequest": "{\n  \"maxResults\": 10,\n  \"query\": \"SELECT * FROM [<your-project-name:<your-dataset-name>.<your-table-name>] WHERE attr_temperature > 90\"\n}",
        "resource": "jobs",
        "resultPath": "working.gcpResponse"
      },
      "id": "iHUFajTLXe",
      "meta": {
        "category": "data",
        "description": "",
        "label": "GCP: BigQuery",
        "name": "google-bigquery",
        "x": 460,
        "y": 120
      },
      "outputIds": [
        [
          "9hfYsZ06Ay"
        ]
      ],
      "type": "GoogleBigQueryNode"
    },
    {
      "config": {
        "message": "",
        "property": ""
      },
      "id": "9hfYsZ06Ay",
      "meta": {
        "category": "output",
        "description": "",
        "label": "Debug",
        "name": "debug",
        "x": 460,
        "y": 220
      },
      "outputIds": [
      ],
      "type": "DebugNode"
    }
  ],
  "triggers": [
    {
      "config": {
      },
      "key": "6149eb3a1e59700006c86c05-O_3G44j8Qp-xznYkqeWrr",
      "meta": {
        "category": "trigger",
        "description": "",
        "label": "Virtual Button",
        "name": "virtualButton",
        "payload": "",
        "uiId": "IjCJRNL7dG",
        "x": 220,
        "y": 20
      },
      "outputIds": [
        [
          "rWYkDRKtg6"
        ]
      ],
      "type": "virtualButton"
    },
    {
      "config": {
      },
      "key": "6149eb3a1e59700006c86c05-3kqmsmMjeyHhaEnVVREJ5",
      "meta": {
        "category": "trigger",
        "description": "",
        "label": "Virtual Button",
        "name": "virtualButton",
        "payload": "",
        "uiId": "syWIJZxsIg",
        "x": 460,
        "y": 20
      },
      "outputIds": [
        [
          "iHUFajTLXe"
        ]
      ],
      "type": "virtualButton"
    },
    {
      "config": {
        "batchBehavior": "each",
        "triggerOn": "both"
      },
      "key": "type/",
      "meta": {
        "category": "trigger",
        "description": "",
        "label": "Device: State",
        "name": "deviceIdsTags",
        "uiId": "c5LYDmNPZM",
        "x": 20,
        "y": 20
      },
      "outputIds": [
        [
          "ggBIoqIqmU"
        ]
      ],
      "type": "deviceTag"
    }
  ]
}