问题很简单。我有以下代码:
# authenticate
bigrquery::bq_auth(path = '/Users/me/restofthepath/bigquery-credentials.json')
# set my project ID and dataset name
project_id <- 'mygreatprojectid'
dataset_name <- 'static'
# how i normally create a new table
players_table = bq_table(project = project_id, dataset = dataset_name, table = 'players')
bq_table_create(x = players_table, fields = as_bq_fields(players_df))
bq_table_upload(x = players_table, values = players_df)在这里,players_df是R中已经计算过的播放器统计数据,下面的代码成功地工作,创建了一个新的表。然而,如果我有更多的球员,我想附加到积分榜上,我正在挣扎。我尝试了以下几点:
bq_table_upload(x = players_table, values = players_df_2)...where players_df_2是另一个拥有更多玩家统计数据的数据.但是,这将返回错误Error: Already Exists: Table mygreatprojectid:static.players [duplicate]。
对于如何做到这一点,最好不用删除+重新创建表有什么想法吗?谢谢!!
编辑:看起来补丁存在,但是这似乎是为了添加新的字段/列,而不是附加新的行.
发布于 2020-06-23 13:13:02
您需要设置WRITE_DISPOSITION和CREATE_DISPOSITION,例如:
bq_table_upload(x=players_table, values= players_df_2, create_disposition='CREATE_IF_NEEDED', write_disposition='WRITE_APPEND')https://stackoverflow.com/questions/62524938
复制相似问题