github.com/Jeffail/benthos/v3@v3.65.0/website/docs/components/processors/gcp_bigquery_select.md (about)

     1  ---
     2  title: gcp_bigquery_select
     3  type: processor
     4  status: experimental
     5  categories: ["Integration"]
     6  ---
     7  
     8  <!--
     9       THIS FILE IS AUTOGENERATED!
    10  
    11       To make changes please edit the contents of:
    12       lib/processor/gcp_bigquery_select.go
    13  -->
    14  
    15  import Tabs from '@theme/Tabs';
    16  import TabItem from '@theme/TabItem';
    17  
    18  :::caution EXPERIMENTAL
    19  This component is experimental and therefore subject to change or removal outside of major version releases.
    20  :::
    21  Executes a `SELECT` query against BigQuery and replaces messages with the rows returned.
    22  
    23  Introduced in version 3.64.0.
    24  
    25  ```yaml
    26  # Config fields, showing default values
    27  label: ""
    28  gcp_bigquery_select:
    29    project: ""
    30    table: ""
    31    columns: []
    32    where: ""
    33    job_labels: {}
    34    args_mapping: ""
    35    prefix: ""
    36    suffix: ""
    37  ```
    38  
    39  ## Examples
    40  
    41  <Tabs defaultValue="Word count" values={[
    42  { label: 'Word count', value: 'Word count', },
    43  ]}>
    44  
    45  <TabItem value="Word count">
    46  
    47  
    48  Given a stream of English terms, enrich the messages with the word count from Shakespeare's public works:
    49  
    50  ```yaml
    51  pipeline:
    52    processors:
    53      - branch:
    54          processors:
    55            - gcp_bigquery_select:
    56                project: test-project
    57                table: bigquery-public-data.samples.shakespeare
    58                columns:
    59                  - word
    60                  - sum(word_count) as total_count
    61                where: word = ?
    62                suffix: |
    63                  GROUP BY word
    64                  ORDER BY total_count DESC
    65                  LIMIT 10
    66                args_mapping: root = [ this.term ]
    67          result_map: |
    68            root.count = this.get("0.total_count")
    69  ```
    70  
    71  </TabItem>
    72  </Tabs>
    73  
    74  ## Fields
    75  
    76  ### `project`
    77  
    78  GCP project where the query job will execute.
    79  
    80  
    81  Type: `string`  
    82  
    83  ### `table`
    84  
    85  Fully-qualified BigQuery table name to query.
    86  
    87  
    88  Type: `string`  
    89  
    90  ```yaml
    91  # Examples
    92  
    93  table: bigquery-public-data.samples.shakespeare
    94  ```
    95  
    96  ### `columns`
    97  
    98  A list of columns to query.
    99  
   100  
   101  Type: `array`  
   102  
   103  ### `where`
   104  
   105  An optional where clause to add. Placeholder arguments are populated with the `args_mapping` field. Placeholders should always be question marks (`?`).
   106  
   107  
   108  Type: `string`  
   109  
   110  ```yaml
   111  # Examples
   112  
   113  where: type = ? and created_at > ?
   114  
   115  where: user_id = ?
   116  ```
   117  
   118  ### `job_labels`
   119  
   120  A list of labels to add to the query job.
   121  
   122  
   123  Type: `object`  
   124  Default: `{}`  
   125  
   126  ### `args_mapping`
   127  
   128  An optional [Bloblang mapping](/docs/guides/bloblang/about) which should evaluate to an array of values matching in size to the number of placeholder arguments in the field `where`.
   129  
   130  
   131  Type: `string`  
   132  
   133  ```yaml
   134  # Examples
   135  
   136  args_mapping: root = [ "article", now().format_timestamp("2006-01-02") ]
   137  ```
   138  
   139  ### `prefix`
   140  
   141  An optional prefix to prepend to the select query (before SELECT).
   142  
   143  
   144  Type: `string`  
   145  
   146  ### `suffix`
   147  
   148  An optional suffix to append to the select query.
   149  
   150  
   151  Type: `string`  
   152  
   153