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

Deprecate Tableau personal token authentication #16916

Merged
merged 3 commits into from
Jul 15, 2021

Conversation

samgans
Copy link
Contributor

@samgans samgans commented Jul 9, 2021

This PR closes #16669.

Why:

Authentication by personal token was not working properly since the Tableau provider's creation due to how the Tableau server client works (it invalidates previous personal token connection if one or more parallel are opened). Therefore, we decided to deprecate it.

Changes:

  1. Remove _auth_via_token method from the TableauHook and make the documentation notes about the deprecation.
  2. Fix get_all method of TableauHook to raise a verbose error when there is wrong object type was supplied.
  3. Deprecate the usage of TableauJobStatusSensor in case of blocking TableauRefreshWorkbookOperator execution to remove the creation of duplicated connection (which is done by a sensor) and to improve the conformity of the class to SRP. Also fix some small documentation issues.
  4. Deprecate testing of the personal token authentication and add change the logic of "blocked" task test.

Copy link
Contributor

@eladkal eladkal left a comment

Choose a reason for hiding this comment

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

Nice analysis of the issue!

Can we deprecate the usage of personal tokens first rather than remove it completely?
I see no reason to make a breaking change here.
People who suffer from this issue will be able to migrate immediately to another authentication method while users who don't will have time to work on it till the next major release.

BTW IMHO as long as Tableau python package allows authentication with personal tokens (despite their limitation) I don't think we should prevent it. If a user wants to use them despite their limited capabilities why should we prevent it? WDYT?

Comment on lines 46 to 51
WARNING: authenticaton by personal token was deprecated as Tableau automatically
invalidates opened personal token connection if one or more parallel
connections with the same token are opened. So, in the environments with
multiple parallel tasks this authentication method can lead to numerous bugs
and all the jobs will not run as they intended. Therefore personal token
auth option is no more available for the end user.
Copy link
Contributor

Choose a reason for hiding this comment

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

@samgans
Copy link
Contributor Author

samgans commented Jul 11, 2021

Hi, @eladkal!

The thing here is that personal token authentication was not working correctly as intended in the scope of Airflow logic, that's why we decided to remove it. But you are right, such a breaking change is what we can avoid at this stage.

Therefore, I can propose to leave the changes I've done apart from removing the method for the authentication in the hook and tests for it. I will put it back and indicate the danger of using a personal token authentication approach in the documentation and the body of the method. Does that make sense?

@eladkal
Copy link
Contributor

eladkal commented Jul 12, 2021

Hi, @eladkal!

The thing here is that personal token authentication was not working correctly as intended in the scope of Airflow logic, that's why we decided to remove it. But you are right, such a breaking change is what we can avoid at this stage.

Therefore, I can propose to leave the changes I've done apart from removing the method for the authentication in the hook and tests for it. I will put it back and indicate the danger of using a personal token authentication approach in the documentation and the body of the method. Does that make sense?

So yeah we should deprecate it first to avoid breaking change. I'm not so sure about removing it as the upstream lib has this functionality in placed. It could be that they will fix the bug related to the parallelism if not we can always remove it eventually.

@potiuk
Copy link
Member

potiuk commented Jul 14, 2021

Some static checks are failing. I HEARTILY recommend to install pre-commit (as suggested in the error message). It will then even auto-correct everything for you @samgans

@samgans
Copy link
Contributor Author

samgans commented Jul 14, 2021

Hello, @potiuk . The thing is that static check asks me to change this:

warnings.warn(
            "Authentication via personal access token is deprecated. "
            "Please, use the password authentication to avoid inconsistencies.",
            DeprecationWarning
        )

To this:

warnings.warn(
            "Authentication via personal access token is deprecated. "
            "Please, use the password authentication to avoid inconsistencies.",
            DeprecationWarning,
        )

Which is not the thing we should have, I guess. What do you think?

UPD: I've rechecked the PEP8 and see that the trailing comma, in this case, is not redundant if we expect this to be extended. I think I will put it here. Thanks.

Copy link
Member

@kaxil kaxil left a comment

Choose a reason for hiding this comment

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

Copy link
Contributor

@eladkal eladkal left a comment

Choose a reason for hiding this comment

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

LGTM

@github-actions
Copy link

The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest main or amend the last commit of the PR, and push it with --force-with-lease.

@github-actions github-actions bot added the okay to merge It's ok to merge this PR as it does not require more tests label Jul 15, 2021
@eladkal eladkal merged commit 53246eb into apache:main Jul 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:providers okay to merge It's ok to merge this PR as it does not require more tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TableauRefreshWorkbookOperator fails when using personal access token (Tableau authentication method)
4 participants