从命令行创建基于表单的外部表时没有架构

时间:2016-08-25 10:56:58

标签: google-bigquery

我发现,对于一个特定的工作表文档,我试图作为外部表引用,标题行在执行查询*时被包含在数据中。我决定删除表并使用定义文件重新创建它,这肯定会暴露文档中的选项。尽管没有在模块中定义,但它似乎没有创建任何模式。

我已经使用包含3列和冻结标题行的简单工作表以及以下test.def文件重新创建了该问题:

{
  "autodetect": false,
  "schema": {
    "fields": [
      {"name": "c1", "type": "STRING", "mode": "nullable"},
      {"name": "c2", "type": "STRING", "mode": "nullable"},
      {"name": "c3", "type": "STRING", "mode": "nullable"},
    ]
  },
  "sourceFormat": "GOOGLE_SHEETS", 
  "sourceUris": [
    "https://docs.google.com/spreadsheets/..."
  ],
  "googleSheetsOptions": {
    "skipLeadingRows": 1
  }
}

然后我尝试使用:

创建文件
bq mk myproject:mydataset.mytable < test.def

表已创建,但没有架构 - 我做错了什么?

  • 这个问题仍然存在,但我无法确定为什么95%的时间表创建好并且第一个/标题行正确地从查询返回的数据中排除但在一个特定情况下,创建方式与所有其他方式相同,标题行在数据中返回...

奇怪:(

中号

1 个答案:

答案 0 :(得分:0)

好的,所以正确的语法是:

 app.controller('authController', function($scope, $http, $rootScope, $location){
   $scope.user = {username: '', password: ''};
   $scope.error_message = '';

   $scope.login = function(){
     $http.post('/auth/login', $scope.user).success(function(data){
       if(data.state == 'success'){
         $rootScope.authenticated = true;
         $rootScope.current_user = data.user.username;
         $location.path('/');
       }
       else{
         $scope.error_message = data.message;
       }
     });
   };

   $scope.register = function(){
     $http.post('/auth/signup', $scope.user).success(function(data){
       if(data.state == 'success'){
         $rootScope.authenticated = true;
         $rootScope.current_user = data.user.username;
         $location.path('/');
       }
       else{
         $scope.error_message = data.message;
       }
     });
   };
 });

这也允许您告诉谷歌跳过工作表上的前导行(从BQ UI无法写入)

中号