GoogleCloudPlatform / bigquery-antipattern-recognition

Utility to identify and rewrite common anti patterns in BigQuery SQL syntax
Apache License 2.0
76 stars 26 forks source link

Rewrite SQL antipattern with Gemini #57

Closed franklinWhaite closed 4 months ago

franklinWhaite commented 4 months ago

This is an experimental feature.

Adding a flag --rewrite_sql if used the output will include a rewritten SQL provided by Gemini.

Please note that the Gemini prompts are handled via a yam file.

This PR provides a the functionality to interact with Gemini and provide the user with a response. Fine tuning of the prompts is a subsequent step.

franklinWhaite commented 4 months ago

@afleisc per the error "Could not rewrite SQL. null".

Is this a single error log or was the execution of the tool interrupted by the tool?

This could be expected behavior. Not al queries will be rewritable since Gemini is not expected to provide valid outputs 100% of times. The code should be able to log this as an error and continue with the execution for the remaining queries.

Is this the case?

afleisc commented 4 months ago

@afleisc per the error "Could not rewrite SQL. null".

Is this a single error log or was the execution of the tool interrupted by the tool?

This could be expected behavior. Not al queries will be rewritable since Gemini is not expected to provide valid outputs 100% of times. The code should be able to log this as an error and continue with the execution for the remaining queries.

Is this the case?

Yes, the tool was not interrupted, it just produced no optimized version so expected behavior