2
2
from datetime import datetime
3
3
import os
4
4
import platform
5
+ import uuid
5
6
6
7
import numpy as np
7
8
import pytest
19
20
PRIVATE_KEY_JSON_PATH = None
20
21
PRIVATE_KEY_JSON_CONTENTS = None
21
22
22
- DATASET_ID = "pydata_pandas_bq_testing_py3"
23
-
24
- TABLE_ID = "new_test"
25
- DESTINATION_TABLE = f"{ DATASET_ID + '1' } .{ TABLE_ID } "
26
-
27
23
VERSION = platform .python_version ()
28
24
29
25
@@ -156,8 +152,10 @@ def gbq_dataset(self):
156
152
_skip_if_no_project_id ()
157
153
_skip_if_no_private_key_path ()
158
154
155
+ dataset_id = "pydata_pandas_bq_testing_py31"
156
+
159
157
self .client = _get_client ()
160
- self .dataset = self .client .dataset (DATASET_ID + "1" )
158
+ self .dataset = self .client .dataset (dataset_id )
161
159
try :
162
160
# Clean-up previous test runs.
163
161
self .client .delete_dataset (self .dataset , delete_contents = True )
@@ -166,13 +164,15 @@ def gbq_dataset(self):
166
164
167
165
self .client .create_dataset (bigquery .Dataset (self .dataset ))
168
166
169
- yield
167
+ table_id = str (uuid .uuid1 ())
168
+ destination_table = f"{ dataset_id } .{ table_id } "
169
+ yield destination_table
170
170
171
171
# Teardown Dataset
172
172
self .client .delete_dataset (self .dataset , delete_contents = True )
173
173
174
174
def test_roundtrip (self , gbq_dataset ):
175
- destination_table = DESTINATION_TABLE + "1"
175
+ destination_table = gbq_dataset
176
176
177
177
test_size = 20001
178
178
df = make_mixed_dataframe_v2 (test_size )
@@ -205,7 +205,7 @@ def test_gbq_if_exists(
205
205
self , if_exists , expected_num_rows , expectation , gbq_dataset
206
206
):
207
207
# GH 29598
208
- destination_table = DESTINATION_TABLE + "2"
208
+ destination_table = gbq_dataset
209
209
210
210
test_size = 200
211
211
df = make_mixed_dataframe_v2 (test_size )
0 commit comments