Skip to main content

CSVファイルをインプットしてTableau Cloudへパブリッシュしたいのですが、コマンド実行すると認証エラーで失敗します。 

 

JSONファイルの"username"と"password"では、個人用アクセス トークン情報を記述しています。 

Tableau CloudはMFAだからNGなのでしょうか? 

 

教えてください。 

 

#Tableau Prep

1 Antwort
  1. 24. März, 21:27

    @Isamu Utashiro

     

    Hi, I guess you are trying to use the Prep Command line to publish the result of a flow to Tableau Cloud. 

     

    As you are forced to use MFA auth, the command line does not work.  Thus, my recommendation is that you generate a local hyper, and then you may use Tableau Server Client (TSC) to upload the file to Tableau Cloud. The code to publish may look like (this code uses Personal Access Token - PAT) 

     

    import tableauserverclient as TSC

    from pathlib import Path

    # server admin creds

    HOST="https://www.yourserver.com"

    TOKENNAME="Diego"

    TOKENID="xuf+0yyw==:55h2hkldDNEP"

    SITE="Entrenamiento"

    PROJECT_NAME="World Indicators"

    ASYNC = True

    FILE = "Devoluciones.hyper"

    DSNAME ="Devoluciones"

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

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

    PATH_TO_FILE = Path(FILE)

    with server.auth.sign_in(tableau_auth):

    publish_mode = TSC.Server.PublishMode.Overwrite

    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 "Accept this Answer"?. 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 Tableau Ambassador 

0/9000