server-client-python icon indicating copy to clipboard operation
server-client-python copied to clipboard

Not able to publish 6gb hyper file to tableau server

Open patilmadhu opened this issue 2 years ago • 1 comments

Versions Details of your environment, including:

  • Tableau Server version (or note if using Tableau Online)
  • python 3.8
  • TSC 0.26

To Reproduce import tableauserverclient as TSC from pathlib import Path

server admin creds

HOST="https://www.yourserver.com" #Use the following to use User and password #USER="youruser" #PWRD="yourpassword" TOKENNAME="tokenname" TOKENID="SF1GzE0yyw==:55h2h" #Use "" to default site SITE="yoursiteurl" #Use "" to default project PROJECT_NAME="World Indicators" ASYNC = True FILE = "filename.hyper" #DATASOURCE NAME DSNAME ="Devoluciones"

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) 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()
Results Async request failed: retrying Blocking request to https:/site_address/api/3.12/sites/someid/fileuploads/someid

NOTE: Be careful not to post user names, passwords, auth tokens or any other private or sensitive information.

patilmadhu avatar Jun 22 '23 07:06 patilmadhu

This is trying to use the async code that is now removed, but I don't think it would work on the current code either.

jacalata avatar May 23 '24 00:05 jacalata