googleapis / googleapis/google-cloud-python

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

Đang mở
#15,697 3 bình luận 1 reaction 1 người được giao Được giao cho @chalmerlowe Xem trên GitHub
api: bigquery type: feature request
Ngôn ngữ chính
Python
Star
5.4k
Fork
1.8k
Merge trung bình
3 ngày 4 giờ
Pull request đã merge (30 ngày)
122

Mô tả

# 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).

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.