allowlarge导致BigQuery无法工作

2024-06-16 13:54:45 发布

您现在位置:Python中文网/ 问答频道 /正文

当我执行这段Python代码时:

body = {
  'configuration': {
    'query': {
      'destinationTable': {
        'projectId': PROJECT_ID,
        'tableId': 'new_items',
        'datasetId': 'data_set'
      },
      'writeDisposition': 'WRITE_TRUNCATE',
      'allowLargeResults': True,
      'query': 'select item from data_set.items where item not in (select item from data_set.old_items);'
    }
  }
} 
job = service.jobs().insert(projectId = PROJECT_ID, body = body).execute()

尽管allowLargeResults设置为True,但我得到以下错误:

Response too large to return. Consider setting allowLargeResults to true in your job configuration.

有谁能解释一下原因,并给我一个提示,告诉我如何消除这个错误?在


Tags: infromprojectidtruedataitemsbody
1条回答
网友
1楼 · 发布于 2024-06-16 13:54:45

我怀疑这个错误是由于查询产生结果的中间阶段之一造成的。最有可能是在NOT in半联接中使用的SELECT。我能想到的唯一解决方法是将查询重写为

select a.item from 
  data_set.items a 
    left outer join each 
  data_set.old_items b
on a.item = b.item 
where b.item IS NULL

notin semijoin子句不允许每个修饰符,但是LEFT OUTER JOIN允许这样做,这将使查询具有伸缩性。在

相关问题 更多 >