从 Select Bigquery 创建一个 table

Create a table from Select Bigquery

您好,我可以在 MSSQL 或 Oracle 中使用 sql 从旧的 table 创建一个 table,如下所示:

Select * into new_table  from  old_table;

可以在 BigQuery 中实现吗?在控制台中输入时出现错误:"Error: Encountered " "INTO" "INTO "" at line 2, column 1. Was expecting: ".

我有一个带有内联用户定义函数的 Select。我喜欢将此 select 的输出存储在单独的 table.

您不能使用 into,但您可以点击 "show options" 和 select 和 table。

对于正在通过 .NET 客户端寻找 C# 解决方案的人API(感谢 oulenz 的提示):

   public void ExecQueryIntoTable(string projectId, string dataSetId, string destinationTable, string query)
    {
        try
        {
            JobsResource jobResource = bigqueryService.Jobs;
            Job theJob = new Job();
            theJob.Configuration = new JobConfiguration()
            {
                Query = new JobConfigurationQuery()
                {
                    AllowLargeResults = true,
                    CreateDisposition = "CREATE_IF_NEEDED",
                    DefaultDataset = new DatasetReference() { ProjectId = projectId, DatasetId = dataSetId},
                    MaximumBillingTier = 100,
                    DestinationTable = new TableReference() { ProjectId = projectId, DatasetId = dataSetId, TableId = destinationTable },
                    Query = query
                }
            };

            var result = jobResource.Insert(theJob, projectId).Execute();
        }
        catch (Exception ex)
        {
            log.Fatal(ex, ex.Message + ", StackTrace: " + ex.StackTrace);
            throw;
        }
    }