I am running dataflow pipeline to load into biqquery but I am getting the below error
wrapper = lambda x: [fn(x)]
File "/home/mprabakaran/mergefile.py", line 93, in NameError: name 'funt1' is not defined [while running 'format data-ptransform-40']
I defined the function 'funt1' as below in my code
def funt1(row):
data={}
data['ID']=row[0]
if row[1]['gender']:
data['gender']=row[1]['gender'][0]
else:
data['gender']=None
if row[1]['weight']:
data['weight']=row[1]['weight'][0]
else:
data['weight']=''
#print(data)
return data
below is the part of pipeline code
data = (({'gender': gender_data, 'weight': weight_data})
| 'Merge' >> beam.CoGroupByKey()
| 'format data' >> beam.Map(lambda x: funt1(x)) | beam.Map(print) )
beam.io.WriteToBigQuery(
table_spec2,
dataset="nyb_data",
project="toyota-poc-340710",
# known_args.output,
# schema='id:INTEGER,gender:STRING,wieght:STRING',
write_disposition=beam.io.BigQueryDisposition.WRITE_TRUNCATE,
create_disposition=beam.io.BigQueryDisposition.CREATE_IF_NEEDED
)
not sure what I am missing. Kindly help me on this.
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)