Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use python client in BQ hook create_empty_table/dataset and table_exists #8377

Merged

Conversation

turbaszek
Copy link
Member


Make sure to mark the boxes below before creating PR: [x]


In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.
Read the Pull Request Guidelines for more information.

@boring-cyborg boring-cyborg bot added the provider:google Google (including GCP) related issues label Apr 15, 2020

table_resource = {
_table_resource: Dict[str, Any] = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(With an eye to minimizing diff to make this easier to review), is there a reason to rename this variable?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason is this line:

 table_resource = table_resource or _table_resource

I wanted to avoid adding a big if clause and building this simple dictionray everytime is not a big performance issue I think.

table_id="test_view",
view={
"query": "SELECT * FROM `{}.test_table`".format(DATASET_NAME),
"query": f"SELECT * FROM `{PROJECT_ID}.{DATASET_NAME}.test_table`",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we using legacy SQL or current SQL here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As you can see line below:

"useLegacySql": False

@turbaszek turbaszek force-pushed the refactor-bg-create-empty-table branch from 5b03d3a to dedeef5 Compare April 19, 2020 15:14
@turbaszek turbaszek changed the title Use python client in BQ hook create_empty_table method Use python client in BQ hook create_empty_table/dataset and table_exists Apr 19, 2020
@turbaszek turbaszek requested a review from mik-laj April 19, 2020 17:25
@turbaszek
Copy link
Member Author

@deJong would you like to take a look?

@turbaszek
Copy link
Member Author

I've run system test (without check operators that are broken on master) and it succeded.

@turbaszek turbaszek merged commit 57c8c05 into apache:master Apr 22, 2020
@turbaszek turbaszek deleted the refactor-bg-create-empty-table branch April 22, 2020 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
provider:google Google (including GCP) related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants