简体   繁体   English

GCP Cloud Function Bigquery 的 JOIN 语句

[英]GCP Cloud Function JOIN Statement for Bigquery

New to Python and GCP but trying to write a HTTPGet request for Cloud Function where it reaches out to Biqguery with specific client_Id, looks up value in one table to returns value from joined table. Python 和 GCP 的新手,但尝试为 Cloud Function 编写 HTTPGet 请求,在该请求中它使用特定的 client_Id 到达 Biqguery,在一个表中查找值以从连接表中返回值。 Works in BQ and when there's no join but when I put the join in the function it breaks.在 BQ 中工作并且没有连接时,但是当我将连接放入 function 时它会中断。 Using Python 3.7 in Cloud Function.在云 Function 中使用 Python 3.7。

Thanks in advance.提前致谢。

name = 'audience-cookie.sometable.traffic'
name2 = 'audience-cookie.sometable.cardholder' 
name3 = 'audience-cookie.sometable.traffic.customerId' 
name4 = 'audience-cookie.sometable.cardholder.customerId'


QUERY = ('SELECT '+column+' FROM '+name+' INNER JOIN '+name2+' ON '+name3+'='+name4+' WHERE Client_Id='+client_Id)

Please use the below format:请使用以下格式:

QUERY = """SELECT columns FROM {} INNER JOIN {} ON {} = {} WHERE Client_Id = '{}'""".format(name, name2, name3, name4, client_Id)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM