Skip to content

Commit 2876697

Browse files
committed
Merge remote-tracking branch 'kyoshidajp/support_description' into support_description
2 parents 3c9d1cd + bd2a748 commit 2876697

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ OAuth flow for installed applications.
5555
| gcs_bucket | string | optional | nil | See [GCS Bucket](#gcs-bucket) |
5656
| auto_create_gcs_bucket | boolean | optional | false | See [GCS Bucket](#gcs-bucket) |
5757
| progress_log_interval | float | optional | nil (Disabled) | Progress log interval. The progress log is disabled by nil (default). NOTE: This option may be removed in a future because a filter plugin can achieve the same goal |
58+
| description | string | optional | nil | description of table |
5859

5960
Client or request options
6061

@@ -324,6 +325,7 @@ Column options are used to aid guessing BigQuery schema, or to define conversion
324325
- json: `STRING`, `RECORD` (default: `STRING`)
325326
- **mode**: BigQuery mode such as `NULLABLE`, `REQUIRED`, and `REPEATED` (string, default: `NULLABLE`)
326327
- **fields**: Describes the nested schema fields if the type property is set to RECORD. Please note that this is **required** for `RECORD` column.
328+
- **description**: description (string, default is `None`).
327329
- **timestamp_format**: timestamp format to convert into/from `timestamp` (string, default is `default_timestamp_format`)
328330
- **timezone**: timezone to convert into/from `timestamp`, `date` (string, default is `default_timezone`).
329331
- **default_timestamp_format**: default timestamp format for column_options (string, default is "%Y-%m-%d %H:%M:%S.%6N")

lib/embulk/output/bigquery/bigquery_client.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,7 @@ def create_table_if_not_exists(table, dataset: nil, options: nil)
420420
table_reference: {
421421
table_id: table,
422422
},
423+
description: @task['description'],
423424
schema: {
424425
fields: fields,
425426
}

lib/embulk/output/bigquery/helper.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,11 @@ def self.fields_from_embulk_schema(task, schema)
4646
embulk_type = column[:type]
4747
column_option = column_options_map[column_name] || {}
4848
{}.tap do |field|
49-
field[:name] = column_name
50-
field[:type] = (column_option['type'] || bq_type_from_embulk_type(embulk_type)).upcase
51-
field[:mode] = column_option['mode'] if column_option['mode']
52-
field[:fields] = deep_symbolize_keys(column_option['fields']) if column_option['fields']
49+
field[:name] = column_name
50+
field[:type] = (column_option['type'] || bq_type_from_embulk_type(embulk_type)).upcase
51+
field[:mode] = column_option['mode'] if column_option['mode']
52+
field[:fields] = deep_symbolize_keys(column_option['fields']) if column_option['fields']
53+
field[:description] = column_option['description'] if column_option['description']
5354
end
5455
end
5556
end

0 commit comments

Comments
 (0)