首页 > 解决方案 > 外部表定义中的 skipLeadingRows=1

问题描述

在下面的示例中,如何设置跳过前导行选项?

bq --location=US query --external_table_definition=sales::Region:STRING,Quarter:STRING,Total_sales:INTEGER@CSV=gs://mybucket/sales.csv 'SELECT Region,Total_sales FROM sales;'

问候, 斯里坎特

标签: google-bigquery

解决方案


可以在安装主文件夹下找到标志选项(我在您要查找的标志下方以粗体标记)

/google-cloud-sdk/platform/bq/bq.py:



--[no]allow_jagged_rows: Whether to allow missing trailing optional columns in
    CSV import data.
  --[no]allow_quoted_newlines: Whether to allow quoted newlines in CSV import
    data.
  -E,--encoding: : The character encoding used by the input
    file. Options include:
    ISO-8859-1 (also known as Latin-1)
    UTF-8
  -F,--field_delimiter: The character that indicates the boundary between
    columns in the input file. "\t" and "tab" are accepted names for tab.
  --[no]ignore_unknown_values: Whether to allow and ignore extra, unrecognized
    values in CSV or JSON import data.
  --max_bad_records: Maximum number of bad records allowed before the entire job
    fails.
    (default: '0')
    (an integer)
  --quote: Quote character to use to enclose records. Default is ". To indicate
    no quote character at all, use an empty string.
  --[no]replace: If true erase existing contents before loading new data.
    (default: 'false')
  --schema: Either a filename or a comma-separated list of fields in the form
    name[:type].
  --skip_leading_rows: The number of rows at the beginning of the source file to
    skip.
    (an integer)
  --source_format: : Format of
    source data. Options include:
    CSV
    NEWLINE_DELIMITED_JSON
    DATASTORE_BACKUP


推荐阅读