【问题标题】:Can't query BigQuery table that was loaded from a Google Sheet because of data type由于数据类型,无法查询从 Google 表格加载的 BigQuery 表
【发布时间】:2019-11-13 16:03:37
【问题描述】:

我从 Google 表格成功创建了表格。然后我尝试查询它,它给出了以下错误:

Could not convert value to integer

我尝试使用 cast 将其转换为字符串,但我一直收到该错误。这是我的查询:

SELECT
 Store, 
CAST ( Timestamp AS DATE) AS TS, 
Agent_Name, 
Product_Category, 
CAST ( What_was_the_QMan_ticket_number_for_this_client_ AS STRING) AS QmanT, 
Freeme, 
LTE 
FROM `tester-253410.test1.Ballito` 
ORDER BY TS DESC

任何帮助将不胜感激。

【问题讨论】:

    标签: sql google-bigquery


    【解决方案1】:

    假设表是指external table,您可以通过在bq mk 中显式指定表架构(带有列类型)来创建外部表。

    https://cloud.google.com/bigquery/external-table-definition#creating_a_table_definition_using_an_inline_schema

    列“What_was_the_QMan_ticket_number_for_this_client_”可以在表创建期间指定为字符串。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多