@@ -92,10 +92,8 @@ def test_client_library_legacy_query():
9292 WHERE state = 'TX'
9393 LIMIT 100
9494 """
95- query_config = bigquery .QueryJobConfig ()
96- query_config .use_legacy_sql = True
95+ query_config = bigquery .QueryJobConfig (use_legacy_sql = True )
9796
98- # Run a Standard SQL query using the environment's default project
9997 df = client .query (sql , job_config = query_config ).to_dataframe ()
10098 # [END bigquery_migration_client_library_query_legacy]
10199 assert len (df ) > 0
@@ -128,11 +126,13 @@ def test_client_library_query_with_parameters():
128126 WHERE state = @state
129127 LIMIT @limit
130128 """
131- query_config = bigquery .QueryJobConfig ()
132- query_config .query_parameters = [
133- bigquery .ScalarQueryParameter ('state' , 'STRING' , 'TX' ),
134- bigquery .ScalarQueryParameter ('limit' , 'INTEGER' , 100 )
135- ]
129+ query_config = bigquery .QueryJobConfig (
130+ query_parameters = [
131+ bigquery .ScalarQueryParameter ('state' , 'STRING' , 'TX' ),
132+ bigquery .ScalarQueryParameter ('limit' , 'INTEGER' , 100 )
133+ ]
134+ )
135+
136136 df = client .query (sql , job_config = query_config ).to_dataframe ()
137137 # [END bigquery_migration_client_library_query_parameters]
138138 assert len (df ) > 0
@@ -165,6 +165,7 @@ def test_pandas_gbq_query_with_parameters():
165165 ]
166166 }
167167 }
168+
168169 df = pandas .read_gbq (sql , configuration = query_config )
169170 # [END bigquery_migration_pandas_gbq_query_parameters]
170171 assert len (df ) > 0
@@ -188,6 +189,7 @@ def test_client_library_upload_from_dataframe(temp_dataset):
188189 dataset_ref = client .dataset (temp_dataset .dataset_id )
189190 # [START bigquery_migration_client_library_upload_from_dataframe]
190191 table_ref = dataset_ref .table ('new_table' )
192+
191193 client .load_table_from_dataframe (df , table_ref ).result ()
192194 # [END bigquery_migration_client_library_upload_from_dataframe]
193195 client = bigquery .Client ()
@@ -214,6 +216,7 @@ def test_pandas_gbq_upload_from_dataframe(temp_dataset):
214216 full_table_id = '{}.{}' .format (temp_dataset .dataset_id , table_id )
215217 project_id = os .environ ['GCLOUD_PROJECT' ]
216218 # [START bigquery_migration_pandas_gbq_upload_from_dataframe]
219+
217220 df .to_gbq (full_table_id , project_id = project_id )
218221 # [END bigquery_migration_pandas_gbq_upload_from_dataframe]
219222 client = bigquery .Client ()
0 commit comments