@@ -1412,6 +1412,23 @@ def test_upload_data_with_timestamp(self):
14121412 result = result_df ['times' ].sort_values ()
14131413 tm .assert_numpy_array_equal (expected .values , result .values )
14141414
1415+ def test_upload_data_with_different_df_and_user_schema (self ):
1416+ df = tm .makeMixedDataFrame ()
1417+ df ['A' ] = df ['A' ].astype (str )
1418+ df ['B' ] = df ['B' ].astype (str )
1419+ test_id = "22"
1420+ test_schema = [{'name' : 'A' , 'type' : 'FLOAT' },
1421+ {'name' : 'B' , 'type' : 'FLOAT' },
1422+ {'name' : 'C' , 'type' : 'STRING' },
1423+ {'name' : 'D' , 'type' : 'TIMESTAMP' }]
1424+ destination_table = self .destination_table + test_id
1425+ gbq .to_gbq (df , destination_table , _get_project_id (),
1426+ private_key = self .credentials ,
1427+ table_schema = test_schema )
1428+ dataset , table = destination_table .split ('.' )
1429+ assert self .table .verify_schema (dataset , table ,
1430+ dict (fields = test_schema ))
1431+
14151432 def test_list_dataset (self ):
14161433 dataset_id = self .dataset_prefix + "1"
14171434 assert dataset_id in self .dataset .datasets ()
0 commit comments