Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google bigquery 使用RESTAPI创建表时,需要多长时间才能使用它?_Google Bigquery - Fatal编程技术网

Google bigquery 使用RESTAPI创建表时,需要多长时间才能使用它?

Google bigquery 使用RESTAPI创建表时,需要多长时间才能使用它?,google-bigquery,Google Bigquery,我正在使用curl成功创建表: $ curl https://www.googleapis.com/bigquery/v2/projects/s2g-bd1-001/datasets/integration_tests/tables?key=$BQKEY -H 'Authorization: Bearer '$BQAUTH -H 'Content-Type: application/json' -d '{"kind": "bigquery#table", "tableReference": {"

我正在使用curl成功创建表:

$ curl https://www.googleapis.com/bigquery/v2/projects/s2g-bd1-001/datasets/integration_tests/tables?key=$BQKEY -H 'Authorization: Bearer '$BQAUTH -H 'Content-Type: application/json' -d '{"kind": "bigquery#table", "tableReference": {"projectId": "s2g-bd1-001", "datasetId": "integration_tests", "tableId": "0479414158500731"}, "friendlyName": "afriendlyname", "description": "afriendlydescription", "schema": {"fields": [{"name": "field1", "type": "STRING"} ] } }'
{
 "kind": "bigquery#table",
 "etag": "\"p8M0C9D2VWWNeiiBOvzKozM5ryM/W3ReJVrhvIimKGxRGXUdDJZI93w\"",
 "id": "s2g-bd1-001:integration_tests.0479414158500731",
 "selfLink": "https://www.googleapis.com/bigquery/v2/projects/s2g-bd1-001/datasets/integration_tests/tables/0479414158500731",
 "tableReference": {
  "projectId": "s2g-bd1-001",
  "datasetId": "integration_tests",
  "tableId": "0479414158500731"
 },
 "friendlyName": "afriendlyname",
 "description": "afriendlydescription",
 "schema": {
  "fields": [
   {
    "name": "field1",
    "type": "STRING"
   }
  ]
 },
 "creationTime": "1403588096488",
 "lastModifiedTime": "1403588096488"
}
但后来我得到一个404试图把它拿回来

$ curl https://www.googleapis.com/bigquery/v2/projects/s2g-bd1-001/datasets/integration_tests/tables/0479414158500731?key=$BQKEY -H 'Authorization: Bearer '$BQAUTH
{
  "error": {   
    "errors": [ {
      "domain": "global",
       "reason": "notFound",
       "message": "Not Found: Table s2g-bd1-001:integration_tests.0479414158500731"    
    } ],   
    "code": 404,   
    "message": "Not Found: Table s2g-bd1-001:integration_tests.0479414158500731"  
  } 
}
当然,创建该表是因为另一个post调用返回409:

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "duplicate",
"message": "Already Exists: Table s2g-bd1-001:integration_tests.0479414158500731"
   }
  ],
  "code": 409,
  "message": "Already Exists: Table s2g-bd1-001:integration_tests.0479414158500731"
 }
}
我能够创建一些这样的表格,并且能够看到它们,但是突然间这些表格就不再具体化了,即使这篇文章成功了。我应该补充一点,我能够通过web控制台成功地创建表


怎么回事

当您收到创建表的响应时,它将同步创建。这意味着一旦你收到你的回应,你应该能够立即与之互动。您可以通过响应中的creationTime字段看到这一点

我不确定您为什么会收到get方法的404。也许可以添加一些try逻辑,然后在中间等待一两秒钟。响应是表资源,因此您也可以使用它,而不是再次检索它

附言:你在发帖的时候有没有把卷发里的帖子漏掉