@@ -118,54 +118,6 @@ def test_create_client_default_credentials():
118118 assert client is not None
119119
120120
121- def test_create_partitioned_table (client , to_delete ):
122- dataset_id = "create_table_partitioned_{}" .format (_millis ())
123- project = client .project
124- dataset_ref = bigquery .DatasetReference (project , dataset_id )
125- dataset = client .create_dataset (dataset_ref )
126- to_delete .append (dataset )
127-
128- # TODO(tswast): remove this snippet once cloud.google.com is updated to use
129- # samples/snippets/create_partitioned_table.py
130- # [START bigquery_create_table_partitioned]
131- # from google.cloud import bigquery
132- # client = bigquery.Client()
133- # project = client.project
134- # dataset_ref = bigquery.DatasetReference(project, 'my_dataset')
135-
136- table_ref = dataset_ref .table ("my_partitioned_table" )
137- schema = [
138- bigquery .SchemaField ("name" , "STRING" ),
139- bigquery .SchemaField ("post_abbr" , "STRING" ),
140- bigquery .SchemaField ("date" , "DATE" ),
141- ]
142- table = bigquery .Table (table_ref , schema = schema )
143- table .time_partitioning = bigquery .TimePartitioning (
144- type_ = bigquery .TimePartitioningType .DAY ,
145- field = "date" , # name of column to use for partitioning
146- expiration_ms = 7776000000 ,
147- ) # 90 days
148-
149- table = client .create_table (table )
150-
151- print (
152- "Created table {}, partitioned on column {}" .format (
153- table .table_id , table .time_partitioning .field
154- )
155- )
156- # [END bigquery_create_table_partitioned]
157-
158- assert table .time_partitioning .type_ == "DAY"
159- assert table .time_partitioning .field == "date"
160- assert table .time_partitioning .expiration_ms == 7776000000
161-
162-
163- @pytest .mark .skip (
164- reason = (
165- "update_table() is flaky "
166- "https://github.com/GoogleCloudPlatform/google-cloud-python/issues/5589"
167- )
168- )
169121@pytest .mark .skip (
170122 reason = (
171123 "update_table() is flaky "
@@ -203,54 +155,6 @@ def test_update_table_description(client, to_delete):
203155 # [END bigquery_update_table_description]
204156
205157
206- @pytest .mark .skip (
207- reason = (
208- "update_table() is flaky "
209- "https://github.com/GoogleCloudPlatform/google-cloud-python/issues/5589"
210- )
211- )
212- def test_relax_column (client , to_delete ):
213- """Updates a schema field from required to nullable."""
214- dataset_id = "relax_column_dataset_{}" .format (_millis ())
215- table_id = "relax_column_table_{}" .format (_millis ())
216- project = client .project
217- dataset_ref = bigquery .DatasetReference (project , dataset_id )
218- dataset = bigquery .Dataset (dataset_ref )
219- dataset = client .create_dataset (dataset )
220- to_delete .append (dataset )
221-
222- # TODO(tswast): remove code sample once references to it on
223- # cloud.google.com are updated to samples/snippets/relax_column.py
224- # [START bigquery_relax_column]
225- # from google.cloud import bigquery
226- # client = bigquery.Client()
227- # dataset_id = 'my_dataset'
228- # table_id = 'my_table'
229-
230- original_schema = [
231- bigquery .SchemaField ("full_name" , "STRING" , mode = "REQUIRED" ),
232- bigquery .SchemaField ("age" , "INTEGER" , mode = "REQUIRED" ),
233- ]
234-
235- dataset_ref = bigquery .DatasetReference (project , dataset_id )
236- table_ref = dataset_ref .table (table_id )
237- table = bigquery .Table (table_ref , schema = original_schema )
238- table = client .create_table (table )
239- assert all (field .mode == "REQUIRED" for field in table .schema )
240-
241- # SchemaField properties cannot be edited after initialization.
242- # To make changes, construct new SchemaField objects.
243- relaxed_schema = [
244- bigquery .SchemaField ("full_name" , "STRING" , mode = "NULLABLE" ),
245- bigquery .SchemaField ("age" , "INTEGER" , mode = "NULLABLE" ),
246- ]
247- table .schema = relaxed_schema
248- table = client .update_table (table , ["schema" ])
249-
250- assert all (field .mode == "NULLABLE" for field in table .schema )
251- # [END bigquery_relax_column]
252-
253-
254158@pytest .mark .skip (
255159 reason = (
256160 "update_table() is flaky "
0 commit comments