bq加载,我得到“太多位置args - 仍然有[...”

时间:2017-07-26 16:54:17

标签: command-line load google-bigquery

我正在尝试将数据从Cloud Storage加载到表中,并在下面收到错误消息。

bq load --skip_leading_rows=1  --field_delimiter='\t' --source_format=CSV projectID:dataset.table gs://bucket/source.txt sku:STRING,variant_id:STRING,title:STRING,category:STRING,description:STRING,buy_url:STRING,mobile_url:STRING,itemset_url:STRING,image_url:STRING,swatch_url:STRING,availability:STRING,issellableonline:STRING,iswebexclusive:STRING,price:STRING,saleprice:STRING,quantity:STRING,coresku_inet:STRING,condition:STRING,productreviewsavg:STRING,productreviewscount:STRING,mediaset:STRING,webindexpty:INTEGER,NormalSalesIndex1:FLOAT,NormalSalesIndex2:FLOAT,NormalSalesIndex3:FLOAT,SalesScore:FLOAT,NormalInventoryIndex1:FLOAT,NormalInventoryIndex2:FLOAT,NormalInventoryIndex3:FLOAT,InventoryScore:FLOAT,finalscore:FLOAT,EDVP:STRING,dropship:STRING,brand:STRING,model_number:STRING,gtin:STRING,color:STRING,size:STRING,gender:STRING,age:STRING,oversized:STRING,ishazardous:STRING,proddept:STRING,prodsubdept:STRING,prodclass:STRING,prodsubclass:STRING,sku_attr_names:STRING,sku_attr_values:STRING,store_id:STRING,store_quantity:STRING,promo_name:STRING,product_badge:STRING,cbl_type_names1:STRING,cbl_type_value1:STRING,cbl_type_names2:STRING,cbl_type_value2:STRING,cbl_type_names3:STRING,cbl_type_value3:STRING,cbl_type_names4:STRING,cbl_type_value4:STRING,cbl_type_names5:STRING,cbl_type_value5:STRING,choice1_name_value:STRING,choice2_name_value:STRING,choice3_name_value:STRING,cbl_is_free_shipping:STRING,isnewflag:STRING,shipping_weight:STRING,masterpath:STRING,accessoriesFlag:STRING,short_copy:STRING,bullet_copy:STRING,map:STRING,display_msrp:STRING,display_price:STRING,suppress_sales_display:STRING,margin:FLOAT

我还尝试将架构加载到json文件中,并收到相同的错误消息。

2 个答案:

答案 0 :(得分:0)

由于这个评论太大而无法发表评论,所以会在此发布。

我想知道如果您将架构文件设置为包含此内容会发生什么:

[{"name": "sku", "type": "STRING"},
 {"name": "variant_id", "type": "STRING"},
 {"name": "title", "type": "STRING"},
 {"name": "category", "type": "STRING"},
 {"name": "description", "type": "STRING"},
 {"name": "buy_url", "type": "STRING"},
 {"name": "mobile_url", "type": "STRING"},
 {"name": "itemset_url", "type": "STRING"},
 {"name": "image_url", "type": "STRING"},
 {"name": "swatch_url", "type": "STRING"},
 {"name": "availability", "type": "STRING"},
 {"name": "issellableonline", "type": "STRING"},
 {"name": "iswebexclusive", "type": "STRING"},
 {"name": "price", "type": "STRING"},
 {"name": "saleprice", "type": "STRING"},
 {"name": "quantity", "type": "STRING"},
 {"name": "coresku_inet", "type": "STRING"},
 {"name": "condition", "type": "STRING"},
 {"name": "productreviewsavg", "type": "STRING"},
 {"name": "productreviewscount", "type": "STRING"},
 {"name": "mediaset", "type": "STRING"},
 {"name": "webindexpty", "type": "INTEGER"},
 {"name": "NormalSalesIndex1", "type": "FLOAT"},
 {"name": "NormalSalesIndex2", "type": "FLOAT"},
 {"name": "NormalSalesIndex3", "type": "FLOAT"},
 {"name": "SalesScore", "type": "FLOAT"},
 {"name": "NormalInventoryIndex1", "type": "FLOAT"},
 {"name": "NormalInventoryIndex2", "type": "FLOAT"},
 {"name": "NormalInventoryIndex3", "type": "FLOAT"},
 {"name": "InventoryScore", "type": "FLOAT"},
 {"name": "finalscore", "type": "FLOAT"},
 {"name": "EDVP", "type": "STRING"},
 {"name": "dropship", "type": "STRING"},
 {"name": "brand", "type": "STRING"},
 {"name": "model_number", "type": "STRING"},
 {"name": "gtin", "type": "STRING"},
 {"name": "color", "type": "STRING"},
 {"name": "size", "type": "STRING"},
 {"name": "gender", "type": "STRING"},
 {"name": "age", "type": "STRING"},
 {"name": "oversized", "type": "STRING"},
 {"name": "ishazardous", "type": "STRING"},
 {"name": "proddept", "type": "STRING"},
 {"name": "prodsubdept", "type": "STRING"},
 {"name": "prodclass", "type": "STRING"},
 {"name": "prodsubclass", "type": "STRING"},
 {"name": "sku_attr_names", "type": "STRING"},
 {"name": "sku_attr_values", "type": "STRING"},
 {"name": "store_id", "type": "STRING"},
 {"name": "store_quantity", "type": "STRING"},
 {"name": "promo_name", "type": "STRING"},
 {"name": "product_badge", "type": "STRING"},
 {"name": "cbl_type_names1", "type": "STRING"},
 {"name": "cbl_type_value1", "type": "STRING"},
 {"name": "cbl_type_names2", "type": "STRING"},
 {"name": "cbl_type_value2", "type": "STRING"},
 {"name": "cbl_type_names3", "type": "STRING"},
 {"name": "cbl_type_value3", "type": "STRING"},
 {"name": "cbl_type_names4", "type": "STRING"},
 {"name": "cbl_type_value4", "type": "STRING"},
 {"name": "cbl_type_names5", "type": "STRING"},
 {"name": "cbl_type_value5", "type": "STRING"},
 {"name": "choice1_name_value", "type": "STRING"},
 {"name": "choice2_name_value", "type": "STRING"},
 {"name": "choice3_name_value", "type": "STRING"},
 {"name": "cbl_is_free_shipping", "type": "STRING"},
 {"name": "isnewflag", "type": "STRING"},
 {"name": "shipping_weight", "type": "STRING"},
 {"name": "masterpath", "type": "STRING"},
 {"name": "accessoriesFlag", "type": "STRING"},
 {"name": "short_copy", "type": "STRING"},
 {"name": "bullet_copy", "type": "STRING"},
 {"name": "map", "type": "STRING"},
 {"name": "display_msrp", "type": "STRING"},
 {"name": "display_price", "type": "STRING"},
 {"name": "suppress_sales_display", "type": "STRING"},
 {"name": "margin", "type": "FLOAT"}]

如果你把它保存在文件" schema.json"并运行命令:

bq load --skip_leading_rows=1  --field_delimiter='\t' --source_format=CSV projectID:dataset.table gs://bucket/source.txt schema.json

你还得到同样的错误吗?

答案 1 :(得分:0)

Cherba钉了它。错误是我的批处理文件中包含额外的负载参数。谢谢你所有的时间考虑。