question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Improved SQL rendering within BigQueryInsertJobOperator

See original GitHub issue

Description

BigQueryInsertJobOperator requires the submission of a configuration parameter in the form of a dict. Unfortunately, if this contains a large SQL query - especially one that is formatted with new lines - then this cannot currently be rendered very nicely in the UI.

Screenshot 2021-07-15 at 15 39 33

Use case / motivation

The issue with this is that it’s impossible to copy and paste the rendered query out of the Airflow UI, into a BigQuery browser and run it without lots of manual edits which is time wasted when troubleshooting problems.

Are you willing to submit a PR?

Yes. My current thought process around this would be to add an optional SQL parameter to the operator which, if provided, would be added into the configuration and could therefore have its own template field and SQL renderer.

e.g.

Screenshot 2021-07-14 at 14 18 09

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:22 (22 by maintainers)

github_iconTop GitHub Comments

2reactions
nathadfieldcommented, Jul 23, 2021

Thanks @potiuk! Have been looking at this at times today and I’m definitely making some progress although it depends on whether @mehmax beats me to it!

Screenshot 2021-07-23 at 16 48 20
2reactions
tswastcommented, Jul 16, 2021

A UI improvement seems like the right choice. https://github.com/apache/airflow/issues/17032#issuecomment-880795289

There are a ton of properties on job resource objects, so I’d be worried about the precedent for adding kwargs for each of them. Especially since query jobs aren’t the only kind of job

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do you pass variables with BigQueryInsertJobOperator in ...
I am trying to pass variable names into a sql file, but I am getting an error. The error is slightly different based...
Read more >
airflow.providers.google.cloud.operators.bigquery
Executes BigQuery SQL queries in a specific BigQuery database. ... Context is the same dictionary used as when rendering jinja templates.
Read more >
BigQuery Dynamic SQL using Jinja Template - Medium
Jinja macros used in this solution for designing reusable SQL statements. ... metadata from BigQuery, and rendering Jinja SQL template with parameters.
Read more >
Writing DAGs (workflows) | Cloud Composer - Google Cloud
... as a Pub/Sub message, then a sensor might work better. If DAG B is integrated closely with DAG A, you might be...
Read more >
apache-airflow-providers-google 8.6.0 - PyPI
All classes for this provider package are in airflow.providers.google python package. ... Common sql bugfixes and improvements (#26761). Fix delay in ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found