Skip to content

Commit 2b4c06f

Browse files
committed
Table creation breaking change:
* All options have been removed from Google.Cloud.BigQuery.V2.TableCreateOptions. * Table create operations overloads added that received a Google.Apis.Bigquery.v2.Data.Table instead. * Extension methods have been added to help in setting some Google.Apis.Bigquery.v2.Data.Table properties.
1 parent 8ea4fe3 commit 2b4c06f

File tree

13 files changed

+783
-195
lines changed

13 files changed

+783
-195
lines changed

apis/Google.Cloud.BigQuery.V2/Google.Cloud.BigQuery.V2.GenerateOverloads/Methods/TableCrud.xml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,11 @@
1313
<Method Name="CreateTable"
1414
TargetType="Table"
1515
ReturnType="BigQueryTable">
16-
1716
<AdditionalParameters>
18-
<Parameter Name="schema" Type="TableSchema" Comment="The schema for the new table. Must not be null unless the schema can be inferred (e.g. for a view)." />
17+
<Parameter Name="resource" Type="Table" Comment="The table resource representation to use for the creation. Must not be null. If this table's &lt;see cref=&quot;Table.TableReference&quot;/&gt; is specified, then it must be the same as the one obtained from the other parameters, else it will be set to the one obtained from the other parameters." />
18+
</AdditionalParameters>
19+
<AdditionalParameters>
20+
<Parameter Name="schema" Type="TableSchema" Comment="The schema for the new table. Must not be null." />
1921
</AdditionalParameters>
2022
<Comments>
2123
<summary>
@@ -29,7 +31,11 @@
2931
TargetType="Table"
3032
ReturnType="BigQueryTable">
3133
<AdditionalParameters>
32-
<Parameter Name="schema" Type="TableSchema" Comment="The schema to use to create the table if necessary. Must not be null unless the schema can be inferred (e.g. for a view)." />
34+
<Parameter Name="resource" Type="Table" Comment="The table resource representation to use for the creation. Must not be null. If this table's &lt;see cref=&quot;Table.TableReference&quot;/&gt; is specified, then it must be the same as the one obtained from the other parameters, else it will be set to the one obtained from the other parameters." />
35+
<Parameter Type="GetTableOptions" Name="getOptions" Comment="The options for the &quot;get&quot; operation. May be null, in which case defaults will be supplied." DefaultValue="null" />
36+
</AdditionalParameters>
37+
<AdditionalParameters>
38+
<Parameter Name="schema" Type="TableSchema" Comment="The schema for the new table. Must not be null." />
3339
<Parameter Type="GetTableOptions" Name="getOptions" Comment="The options for the &quot;get&quot; operation. May be null, in which case defaults will be supplied." DefaultValue="null" />
3440
</AdditionalParameters>
3541
<Options Type="CreateTableOptions" Name="createOptions" Comment="The options for the &quot;create&quot; operation. May be null, in which case defaults will be supplied." />

apis/Google.Cloud.BigQuery.V2/Google.Cloud.BigQuery.V2.IntegrationTests/QueryTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ public void QueryOnView()
397397
var client = BigQueryClient.Create(_fixture.ProjectId);
398398
var table = client.GetTable(_fixture.DatasetId, _fixture.HighScoreTableId);
399399
var viewDefinition = new ViewDefinition { Query = $"SELECT player, MAX(score) AS score FROM {table} WHERE player IS NOT NULL GROUP BY player ORDER BY 2 DESC", UseLegacySql = false };
400-
var view = client.CreateTable(_fixture.DatasetId, "highscore_view", schema: null, options: new CreateTableOptions { View = viewDefinition });
400+
var view = client.CreateTable(_fixture.DatasetId, "highscore_view", new Table { View = viewDefinition });
401401

402402
// This is how a client can check that a BigQueryTable is a view.
403403
Assert.NotNull(view.Resource.View);
@@ -559,8 +559,8 @@ public void PartiallyBrokenQuery()
559559
MaxBadRecords = 1,
560560
SourceUris = new[] { $"gs://{bucketName}/{objectName}" },
561561
};
562-
var table = client.CreateTable(_fixture.DatasetId, _fixture.CreateTableId(),
563-
schema, new CreateTableOptions { ExternalDataConfiguration = configuration });
562+
var table = client.CreateTable(
563+
_fixture.DatasetId, _fixture.CreateTableId(), new Table { ExternalDataConfiguration = configuration, Schema = schema });
564564

565565
// Run a query
566566
var results = client.ExecuteQuery($"SELECT * FROM {table:legacy}", null, new QueryOptions { UseLegacySql = true });

0 commit comments

Comments
 (0)