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

Title: Unable to Change API Version in Tableau Migration SDK from 3.23 to 3.20 #33

Closed
williequ opened this issue Aug 19, 2024 · 4 comments
Assignees

Comments

@williequ
Copy link

Description:
I am currently using the Tableau Migration SDK for migrating content from Tableau Server to Tableau Cloud. However, I am encountering an issue where the SDK seems to enforce the usage of API version 3.23, despite my attempts to use API version 3.20 instead.

Steps to Reproduce:

1.	Initialize the migration plan using the following code:
plan_builder = plan_builder \
             .from_source_tableau_server(
                 server_url="https://prod-apsoutheast-a.online.tableau.com/api/3.20",
                 site_content_url=config['SOURCE']['SITE_CONTENT_URL'],
                 access_token_name=config['SOURCE']['ACCESS_TOKEN_NAME'],
                 access_token=os.environ.get('TABLEAU_MIGRATION_SOURCE_TOKEN', config['SOURCE']['ACCESS_TOKEN']),
                 create_api_simulator=False
             )
2.	Attempt to run the migration.
             Expected Behavior:
             The SDK should use the specified API version 3.20 as indicated in the server_url.

            Actual Behavior:
            The SDK continues to use API version 3.23, as evidenced by the logs:
            2024-08-19 12:50:34,942 - System.Net.Http.HttpClient.DefaultHttpClient.LogicalHandler - INFO - Start processing 
             HTTP request POST https://prod-apsoutheast-a.online.tableau.com/api/3.23/auth/signin
             Additionally, this results in a 401 Unauthorized error due to an invalid personal access token, even though the token is 
             valid and works with API version 3.20.

              2024-08-19 12:50:35,087 - Tableau.Migration.Engine.Manifest.MigrationManifest - ERROR - An error occurred during 
             migration. Error: Tableau.Migration.Api.Rest.RestException: An error was returned from the Tableau API:
             URL: POST https://prod-apsoutheast-a.online.tableau.com/api/3.23/auth/signin
             Code: 401001
             Summary: Signin Error

              Attempts to Resolve:

           1.	Tried manually specifying the API version in the server_url.

              Questions:

           1.	Is there a way to explicitly set the API version to 3.20 within the SDK?
           2.	If not, is there a recommended workaround for using API version 3.20?
@pvshn pvshn self-assigned this Aug 19, 2024
@pvshn
Copy link
Collaborator

pvshn commented Aug 19, 2024

Thanks for logging the issue for a clarification.

The server URL should not have a version specified in it. It should just be https://prod-apsoutheast-a.online.tableau.com/. The personal access token (PAT) is not API version dependent. As long as it is still valid, it works for all supported Tableau API versions.

Here are my answers to your questions:

  1. We do not support changing the API Version since it is not hardcoded in the SDK. It gets the API version from tableau server/cloud and uses that.
  2. We do not have an easy workaround, unfortunately because of that above reasons. This is because managing API versions does not have a good cost-benefit ratio.

May I ask why you want to go back to 3.20. Is there specific SDK functionality you are looking for ?

@williequ
Copy link
Author

Hi pvshn,

Thank you for your detailed explanation and for addressing my queries.

The reason I want to use API version 3.20 is that the Tableau Cloud version I am currently working with is 3.20. However, I encounter an "unauthorized" error message every time I run my code. I suspect this might be due to the API version mismatch.

@pvshn
Copy link
Collaborator

pvshn commented Aug 19, 2024

You should not include the API version in the URL because the SDK does not support that URL format. It should just be something like http://my-server-url. See this sample config for reference.

I have just noticed that the server_url you are passing in is for Tableau cloud. I see you are doing a Server to Cloud migration. Perhaps you accidentally pasted the destination Cloud URL instead of the source one.

A few other things to note

  1. Personal Access Tokens do expire. It is worth checking that and creating a new one if needed.
  2. The token secret is in an environment variable. So, you need to make sure the correct value is available before you run your app. In some cases, it involves running it in a new console session.

@williequ
Copy link
Author

williequ commented Sep 2, 2024

Thank you for your answer pvshn, I have new issues right now. Once I run the code its working, but one question is it really slow, and it will send message to my manager, and the message is about Fwd: You've Been Invited to Tableau Cloud, after he received email, he cannot login to the tableau cloud anymore, the error message is MFA not current. For this code, can i modify the data source like in the source the data source is postgre.com.au and in the destination is postgres2.com.au
Thanks

@williequ williequ closed this as completed Sep 2, 2024
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

No branches or pull requests

2 participants