googleapis / googleapis/google-cloud-python

How to identify individual queries within a multi-statement query.

未关闭
#15,697 3 条评论 1 个 reaction 已指派 1 人 已指派给 @chalmerlowe 在 GitHub 查看
api: bigquery type: feature request
主要语言
Python
星标
5.4k
派生
1.8k
平均合并
3 天 4 小时
30 天内合并 PR
122

描述

# Problem

We want to be able to identify specific queries within multi-statement queries and handle their results differently. Currently you can get the child jobs of a multi-statement query job, and they are sort of identifiable by index if you parse the suffix of the job ID. If we use this method of query identification, it tightly couples the python code with the SQL code which is very brittle and requires changes in multiple places when updating the SQL code.

# Proposed Solution

Provide a first class method of identifying and / or tagging queries in the SQL syntax.

# Alternative Solution

One way we could solve this right now is by using comments in the SQL. However, when we read the SQL in the jobs, most comments are stripped out. I've found that if I insert a comment right after the first keyword in the statement, it won't be stripped out. I could add a comment for the queries I want to identify and include tags that I search for in the python code. This would work, except it feels likely to break if the behavior is updated such that those comments start getting stripped out (I highly doubt that behavior is an intentional part of the interface).

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。