Skip to content

[AIRFLOW-3948] GCSToBQOperator list as templating field issue - #4770

Closed
ryanyuan wants to merge 5 commits into
apache:masterfrom
ryanyuan:gcs-to-bq-op-list-templating
Closed

ryanyuan wants to merge 5 commits into
apache:masterfrom
ryanyuan:gcs-to-bq-op-list-templating

Conversation

@ryanyuan

@ryanyuan ryanyuan commented Feb 25, 2019 •

Copy link
Copy Markdown
Contributor

Fix GCSToBQOp list templating
Add unit tests for GCSToBQOp

Make sure you have checked all steps below.

Jira

  • My PR addresses the following Airflow-3948 issues and references them in the PR title. For example, "[AIRFLOW-XXX] My Airflow PR"

Description

  • Here are some details about my PR, including screenshots of any UI changes:

Tests

  • My PR adds the following unit tests OR does not need testing for this extremely good reason:
    tests/contrib/operators/test_gcs_to_bq_operator.py

Commits

  • My commits all reference Jira issues in their subject lines, and I have squashed multiple commits if they address the same issue. In addition, my commits follow the guidelines from "How to write a good git commit message":
    1. Subject is separated from body by a blank line
    2. Subject is limited to 50 characters (not including Jira issue reference)
    3. Subject does not end with a period
    4. Subject uses the imperative mood ("add", not "adding")
    5. Body wraps at 72 characters
    6. Body explains "what" and "why", not "how"

Documentation

  • In case of new functionality, my PR adds documentation that describes how to use it.
    • When adding new operators/hooks/sensors, the autoclass documentation generation needs to be added.
    • All the public functions and the classes in the PR contain docstrings that explain what it does

Code Quality

  • Passes flake8

@ryanyuan ryanyuan closed this Feb 25, 2019
@ryanyuan ryanyuan reopened this Feb 25, 2019
@codecov-io

codecov-io commented Feb 25, 2019 •

Copy link
Copy Markdown

Codecov Report

Merging #4770 into master will increase coverage by 0.19%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4770      +/-   ##
==========================================
+ Coverage   74.45%   74.64%   +0.19%     
==========================================
  Files         450      450              
  Lines       28972    28988      +16     
==========================================
+ Hits        21570    21637      +67     
+ Misses       7402     7351      -51
Impacted Files Coverage Δ
airflow/contrib/operators/gcs_to_bq.py 84.61% <100%> (+84.61%) ⬆️
airflow/contrib/operators/ssh_operator.py 82.27% <0%> (-1.27%) ⬇️
airflow/www/security.py 92.92% <0%> (+0.03%) ⬆️
airflow/www/decorators.py 74.5% <0%> (+0.5%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c50a851...a3c683e. Read the comment docs.

@codecov-io

Copy link
Copy Markdown

Codecov Report

Merging #4770 into master will increase coverage by 0.19%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #4770      +/-   ##
==========================================
+ Coverage   74.45%   74.64%   +0.19%     
==========================================
  Files         450      450              
  Lines       28972    28991      +19     
==========================================
+ Hits        21570    21640      +70     
+ Misses       7402     7351      -51
Impacted Files Coverage Δ
airflow/contrib/operators/gcs_to_bq.py 85.18% <100%> (+85.18%) ⬆️
airflow/contrib/operators/ssh_operator.py 82.27% <0%> (-1.27%) ⬇️
airflow/www/security.py 92.92% <0%> (+0.03%) ⬆️
airflow/www/decorators.py 74.5% <0%> (+0.5%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c50a851...35f7eb6. Read the comment docs.

Comment thread airflow/contrib/operators/gcs_to_bq.py Outdated
from airflow.utils.decorators import apply_defaults

try:
basestring

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there any reason why you have not used the six package here? Using this package makes it easier to track where we have the code for the older version of Python. We plan to drop support for the older version, so we will simply delete all references to the six package.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@mik-laj Thanks for the suggestion. I've updated my code.

…an committed

Change basestring to six.string_types
@Fokko

Fokko commented Feb 27, 2019

Copy link
Copy Markdown
Contributor

Wouldn't this be an issue for templated lists in general?

@ryanyuan

Copy link
Copy Markdown
Contributor Author

Wouldn't this be an issue for templated lists in general?

@Fokko That's true. My suggestion is to move the conversion function to utils.helpers and perform conversion for those jinja templating fields that are of list type. What do you think?

@Fokko

Fokko commented Mar 4, 2019

Copy link
Copy Markdown
Contributor

I would prefer to solve this on a global level, yes! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants