1515# limitations under the License.
1616import datetime
1717import decimal
18- import pandas as pd
19- import pyarrow as pa
2018
2119from google .cloud import bigquery
2220from google .cloud .bigquery import enums
23-
2421from google .cloud .bigquery_storage_v1 import types as gapic_types
2522from google .cloud .bigquery_storage_v1 .writer import AppendRowsStream
23+ import pandas as pd
24+
25+ import pyarrow as pa
2626
2727
2828def bqstorage_write_client ():
@@ -31,7 +31,7 @@ def bqstorage_write_client():
3131 return bigquery_storage_v1 .BigQueryWriteClient ()
3232
3333
34- def make_table (project_id , dataset , table_id , bq_client ):
34+ def make_table (project_id , dataset , bq_client ):
3535 schema = [
3636 bigquery .SchemaField ("bool_col" , enums .SqlTypeNames .BOOLEAN ),
3737 bigquery .SchemaField ("int64_col" , enums .SqlTypeNames .INT64 ),
@@ -59,6 +59,7 @@ def make_table(project_id, dataset, table_id, bq_client):
5959 range_element_type = "TIMESTAMP" ,
6060 ),
6161 ]
62+ table_id = "append_rows_w_arrow_test"
6263 table_id_full = f"{ project_id } .{ dataset } .{ table_id } "
6364 bq_table = bigquery .Table (table_id_full , schema = schema )
6465 created_table = bq_client .create_table (bq_table )
@@ -167,8 +168,8 @@ def append_rows(bqstorage_write_client, table):
167168 print (e )
168169
169170
170- def main (project_id , dataset_id , table_id ):
171+ def main (project_id , dataset_id ):
171172 write_client = bqstorage_write_client ()
172173 bq_client = bigquery .Client ()
173- table = make_table (project_id , dataset_id , table_id , bq_client )
174+ table = make_table (project_id , dataset_id , bq_client )
174175 append_rows (write_client , table )
0 commit comments