我有一个每日 csv 文件进入 Google 存储上的存储桶,我构建了一个函数来加载该 csv 并将其附加到 BigQuery 中的表中。但是,我想使用该函数向 csv 添加一个新列在将数据加载到大查询之前执行 id (context["id"]) 。
那可能吗?
提前致谢!
def TimeTableToBigQuery(data, context):
# Getting metadata about the uploaded file, the storage and datetime of insert
excution_id = context['event_id']
bucketname = data['bucket']
filename = data['name']
timeCreated = data['timeCreated']
pathtofile = data["id"].rsplit("/", 2)
# parent_folder = data["id"].rsplit("/", 3)
file = str(pathtofile[1])
name = file.split('---')
dates = name[0].split('_', 1)
arrivedat = str(dates[1])
path = pathtofile[0]
# parent_folder = parent_folder[1]
# work start here to get the …Run Code Online (Sandbox Code Playgroud) python-3.x google-bigquery google-cloud-platform google-cloud-functions