Skip to main content
Gerard Scheitlin a posé une question dans #Tableau Prep

As I am a small business and do not want to pay for Data Management, and hence Tableau Prep Conductor, I run my flows from the command line on a scheduler.

 

From what I can tell, you have to be a creator to send outputs to a published data source (Tableau Online). With the recent change in authentication requirements, you have to use MFA (Google Auth) to sign into Tableau online. Therefore, my current credentials file does not work and I cannot find anything that tells me how to set it up for MFA.

 

Can somebody please help me understand how to either:

  1. Change my credentials file for MFA
  2. Allow an Explorer (Can Publish) to be able to publish output data files to Tableau Online so I can use Tableau Authentication for the explorer and the standard credentials file.

 

I have attached the most recent roles chart that I can find. This shows that you have to be a creator to "Create Data Sources", which is what appears to be needed for Tableau Prep to publish to an online data source.

 

Thanks

2 réponses
  1. 2 mai 2023, 18:24

    @Gerard Scheitlin​ 

    Hi, your options are quite small. Unfortunatelly, prep command line does not support MFA or PAT authentication.

     

    Option 1:

    You may publish your flow to Tableau Cloud, and use a script to run the flow directly in Tableau Cloud using tableau server client. The down side is that if you don't have Data Management Add On, you only have 1 hour of flow runs per each creator license. This approach uses PAT to sign in to Tableau Cloud.

    https://community.tableau.com/s/question/0D58b0000Az28bjCQA/schedule-refresh-flow

    https://help.tableau.com/current/online/en-us/security_personal_access_tokens.htm

     

    Option 2:

    You may create a hyper file from your flow, so you won't need to login to Tableau Cloud (unless you use published data sources in your flow as inputs), and then publish the hyper file using tableau server client. You may use a python code like:

    import tableauserverclient as TSC

    from pathlib import Path

     

    # server admin creds

    HOST="https://prod-useast-b.online.tableau.com"

    #Use the following to use User and password

    #USER="username"

    #PWRD="password"

    #When using PAT Sign in

    TOKENNAME="your_token_name"

    TOKENID="your_token_key-id"

    #Use "" to default site

    SITE="yoursiteurl"

    #Use "" to default project

    PROJECT_NAME="Your Project Name"

    ASYNC = True

    FILE = "yourhypernamefile.hyper"

    DSNAME ="Your Desired Published DS Name"

     

    server = TSC.Server(HOST, use_server_version=True)

    #Use the following to sign in with user and password

    #tableau_auth = TSC.TableauAuth(USER,PWRD,site=SITE)

    #Use the following for PAT

    tableau_auth = TSC.PersonalAccessTokenAuth(TOKENNAME, TOKENID, site_id=SITE)

     

    PATH_TO_FILE = Path(FILE)

    with server.auth.sign_in(tableau_auth):

    # Define publish mode - Overwrite, Append, or CreateNew

    publish_mode = TSC.Server.PublishMode.Overwrite

    # Get project_id from PROJECT_NAME

    all_projects, pagination_item = server.projects.get()

    for project in TSC.Pager(server.projects):

    if project.name == PROJECT_NAME:

    project_id = project.id

    new_conn_creds = None

    # Create the datasource object with the project_id

    datasource = TSC.DatasourceItem(project_id)

    new_datasource = TSC.DatasourceItem(project_id=project_id,name=DSNAME)

    print(f"Publishing {FILE} to {PROJECT_NAME}...")

    # Publish datasource

    if ASYNC:

    # Async publishing, returns a job_item

    new_job = server.datasources.publish(datasource, PATH_TO_FILE, publish_mode, connection_credentials=new_conn_creds, as_job=ASYNC)

    print("Datasource published asynchronously. Job ID: {0}".format(new_job.id))

    else:

    # Normal publishing, returns a datasource_item

    new_datasource = server.datasources.publish(datasource, PATH_TO_FILE, publish_mode,connection_credentials=new_conn_creds)

    print("Datasource published. Datasource ID: {0}".format(new_datasource.id))

     

    #Don't forget to sign out

    server.auth.sign_out()

    If this post resolves the question, would you be so kind to "Select as Best"?. This will help other users find the same answer/resolution and help community keep track of answered questions. Thank you.

     

    Regards,

     

    Diego Martinez

    Tableau Visionary and Forums Ambassador

0/9000