2017-02-19 31 views
1

我有一個問題,@在JSON模式字段名稱標誌,谷歌的BigQuery

我不能json的文件我要上傳至BigQuery,因爲我有我的字段名稱@分配JSON模式。

"Events": { 
    "type": "object", 
    "properties": { 
    "Event": { 
     "type": "object", 
     "properties": { 
     "@places": { 
      "type": "object", 
      "properties": { 
      "id": { 
       "type": "integer" 
      }, 
      "comp_id": { 
       "type": "string" 
      }, 
      "manager_id": { 
       "type": "integer" 
      }, 
      "price": { 
       "type": "integer" 
      }, 
      "size": { 
       "type": "integer" 
      }, 
      "location": { 
       "type": "integer" 
      }, 
      "date": { 
       "type": "object", 
       "properties": { 
       "locale": { 
        "type": "string" 

回答

0

雖然你把一個JSON密鑰的任何字符串是有效的,也Q: Which characters are valid/invalid in a JSON key name?看到,數據的消費者可能有,這實際上是不允許的具體要求。

在你的情況下,BigQuery是消費者,它可能只是它不接受某些字符。如果是這種情況,除了從您的模式中刪除特殊字符(在您的情況下爲「@」)之外沒有別的辦法。

0

JSON文件中的字段將作爲字段添加到BigQuery表中。 @不允許在BigQuery表的字段名中使用,因此您不能在JSON文件中使用它。

從BQ文檔:

名稱只能包含字母(A-Z,A-Z),數字(0-9),或 下劃線(_),並且必須以字母或下劃線開始。 的最大長度是128個字符。