public void CopyTable(
        string projectId            = "your-project-id",
        string destinationDatasetId = "your_dataset_id"
        )
    {
        BigQueryClient client         = BigQueryClient.Create(projectId);
        TableReference sourceTableRef = new TableReference()
        {
            TableId   = "shakespeare",
            DatasetId = "samples",
            ProjectId = "bigquery-public-data"
        };
        TableReference destinationTableRef = client.GetTableReference(
            destinationDatasetId, "destination_table");
        BigQueryJob job = client.CreateCopyJob(
            sourceTableRef, destinationTableRef)
                          .PollUntilCompleted() // Wait for the job to complete.
                          .ThrowOnAnyError();

        // Retrieve destination table
        BigQueryTable destinationTable = client.GetTable(destinationTableRef);

        Console.WriteLine(
            $"Copied {destinationTable.Resource.NumRows} rows from table "
            + $"{sourceTableRef.DatasetId}.{sourceTableRef.TableId} "
            + $"to {destinationTable.FullyQualifiedId}."
            );
    }
Пример #2
0
        private void setupTable(DateTime dateTime)
        {
            DateTime       now = DateTime.UtcNow;
            TableReference src = new TableReference()
            {
                ProjectId = "firebase-lispace",
                DatasetId = "binance_orderbooks",
                TableId   = "template"
            };
            TableReference dst = new TableReference()
            {
                ProjectId = "firebase-lispace",
                DatasetId = "binance_orderbooks",
                TableId   = getTableName(dateTime)
            };

            bqClient.CreateCopyJob(src, dst);
        }