-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
[AIRFLOW-3490] BigQueryHook's Ability to Patch Table/View #4299
Conversation
Add patch_table() to BQHook, and its unit tests
Add Google reference
Hi @kaxil, could you please review this? |
Codecov Report
@@ Coverage Diff @@
## master #4299 +/- ##
==========================================
- Coverage 78.59% 74.76% -3.84%
==========================================
Files 204 428 +224
Lines 16453 29638 +13185
==========================================
+ Hits 12932 22159 +9227
- Misses 3521 7479 +3958
Continue to review full report at Codecov.
|
view=None): | ||
""" | ||
Patch information in an existing table/view. | ||
Schema changes can only be applied to tables, not views. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to support more than just updating schema as done by the api https://cloud.google.com/bigquery/docs/reference/rest/v2/tables/patch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kaxil Updated. Please review.
Add more parameters to patch_table to support more information to be patched
|
||
:param project_id: The project containing the table to be patched. | ||
:type project_id: str | ||
:param dataset_id: The dataset containing the tableto be patched. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:param dataset_id: The dataset containing the tableto be patched. | |
:param dataset_id: The dataset containing the table to be patched. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kaxil Changed.
def patch_table(self, | ||
dataset_id, | ||
table_id, | ||
project_id=None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have updated this as project_id can be None as we take that info from the connection.
Can you update the tests accordingly.
Update BigQueryHook's patch_table tests for optional project_id
Thanks @ryanyuan |
Add patch_table() to BQHook, and its unit tests
Make sure you have checked all steps below.
Jira
Description
Add patch_table() to BigQueryBaseCursor in BigQueryHook so that it has ability to patch tables and patch views.
Tests
tests.contrib.hooks.test_bigquery_hook:TestBigQueryBaseCursor.test_patch_table
tests.contrib.hooks.test_bigquery_hook:TestBigQueryBaseCursor.test_patch_view
Commits
Documentation
Code Quality
flake8