Skip to content

Commit

Permalink
Updates in response to code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh McGinley committed Jun 8, 2018
1 parent 03e82fa commit e6dad25
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class DataGenerator(object):
"""
def __init__(self, bq_schema_filename=None, input_bq_table=None, p_null=0.1, n_keys=1000,
min_date=datetime.date(2000,1,1), max_date=datetime.date.today(),
min_date=datetime.date(2000, 1, 1), max_date=datetime.date.today(),
only_pos=True, max_int=10**11, max_float=float(10**11), float_precision=2,
write_disp='WRITE_APPEND'):
"""
Expand Down Expand Up @@ -126,7 +126,7 @@ def __init__(self, bq_schema_filename=None, input_bq_table=None, p_null=0.1, n_k
except ValueError as e:
logging.error("Not a valid json file! \n %s", e)
except AttributeError:
logging.error("Could not find gcs file %s", str(bq_schema_filename))
logging.error("Could not find gcs file %s", bq_schema_filename)
elif input_bq_table:
bq_cli = bq.Client()

Expand Down Expand Up @@ -271,7 +271,7 @@ def sanity_check(self, record, fieldname):
if '_key' in field['name'].lower() or '_id' in field['name'].lower():
key_mag = int(math.log10(self.data_gen.n_keys))
# Assume the key field is of string type and format it to be left zero padded.
record[fieldname] = format(np.random.randint(0, self.data_gen.n_keys),
record[fieldname] = 'L-' + format(np.random.randint(0, self.data_gen.n_keys),
'0%dd' % (key_mag + 1))
return record

Expand Down

0 comments on commit e6dad25

Please sign in to comment.