googleapis / googleapis/google-cloud-python

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

Aperta
#15,697 3 commenti 1 reazione 1 assegnatario Assegnata a @chalmerlowe Vedi su GitHub
api: bigquery type: feature request
Lingua principale
Python
Stelle
5.4k
Fork
1.8k
Merge medio
3g 4h
PR unite (30g)
122

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.