Skip to main content

#Import0 debatiendo

Hello!

 

I have this question about Tableau Server Client (Python) library. We are trying to query datasources with Viewer license user who has access to data source and the workbook. However I'm getting error "user isn't authorized to query datasource 'datasource_id'"

 

It works if user has site admin (Creator) or Explorer license role. My question is if it's possible to query datasource with Viewer license?

 

I have also tried curl request with same user and license type. Using curl I was able to get info about datasource. I also don't have much knowledge about using rest api so it might be issue on my side.

3 respuestas
  1. 6 sept 2024, 14:40

    @Matthias Johann Kurs​ 

    Hi, I think it is possible. I have run this code and it worked:

    #import os

    from datetime import datetime, timezone

    import datetime as DT

    import tableauserverclient as TSC

     

    literal_date = DT.datetime(2000, 1, 1)

    SERVER = 'https://yourserver.com'

    #tableau_auth = TSC.PersonalAccessTokenAuth(PAT_NAME,PAT_VALUE,site_id=SITE_NAME)

    tableau_auth = TSC.TableauAuth('viewer', 'mypasswd', site_id='')

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

    with server.auth.sign_in(tableau_auth):

    print('Logged in')

    now = datetime.now(timezone.utc)

    print(now)

    datasources = [ds for ds in TSC.Pager(server.datasources) if (now-(ds.updated_at or literal_date)).days>=1 and ds.has_extracts]

    for ds in datasources:

    print((now-(ds.updated_at or now)).days, ds.name, ds.updated_at, ds.project_name)

    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.

     

    Does the user has the view and connect permission for the published data source?

     

    Thank you.

     

    Regards,

     

    Diego Martinez

    Tableau Visionary and Forums Ambassador

0/9000

Hi, do anybody know how to use the Data import Wizard as a button. When it clicked, it should create a subtab from the record and display the Data import wizard UI on it. 

 

#Salesforce  #Education Cloud  #Import  #Import Data Challenge

4 respuestas
  1. 6 ago 2025, 17:25

    @Saurabh Singh

    I'm trying to build this out to load custom records to an opportunity. The button works but it doesn't seem to be pulling in the Opportunity ID from the record where the button is placed. When I try to load the records I'm getting this error. Do I need to have the ID in my file or should this URL map it to each record that I load? 

     

    I'm trying to build this out to load custom records to an opportunity. The button works but it doesn't seem to be pulling in the Opportunity ID from the record where the button is placed.

     

     

     

     

0/9000

I am currently working on a data migration. In this process I was curious if there are any monthly record limits I should keep in mind. 

 

I know in Dataloader.io the monthly record limit is 10,000 records because of only having the free version, but does the same rule apply with the  Salesforce Dataloader that you download on your computer? 

 

Also are there any monthly record limits I should keep in mind for Data Import wizard? 

 

#Import  #Dataloader  #Org Migration

4 respuestas
0/9000

I can't select the 'Map' button in the data import because it's covered up by the 'Cancel' and 'Next' bar. Has anyone had this problem and figured out a fix?

I can't select the 'Map' button in the data import because it's covered up by the 'Cancel' and 'Next' bar. Has anyone had this problem and figured out a fix?

 

#Import Data Challenge  #Import  #NPSP Import Tool

0/9000

It's not creating the AD group. I'm not sure what is the problem. When I get the status of the job_id it shows below.

<Job#dae06783-46c2-4b62-87c1-a914f5714d5f GroupImport created_at(2022-03-08 11:01:19+00:00) started_at(None) completed_at(2022-03-08 11:01:19+00:00) progress (100) finish_code(1)>

 

My code:

#Import packages

import tableauserverclient as TSC

 

# Make connection with Tableau Serevr

tableau_auth = TSC.PersonalAccessTokenAuth('signin', 'abc', 'abc')

server = TSC.Server('http://tableausite', use_server_version=True)

 

# Create group & assign a miminum site role

with server.auth.sign_in(tableau_auth):

    # create a new instance with the group name

 

    newgroup = TSC.GroupItem('Tableau-VIEWER','corp.athenahealth.com')

    newgroup.minimum_site_role = TSC.UserItem.Roles.Unlicensed

    newgroup.license_mode = TSC.GroupItem.LicenseMode.onLogin

 

    # call the create method

    newADgroup = server.groups.create_AD_group(newgroup, asJob=True)

    print(newADgroup)

 

    jobinfo= server.jobs.get_by_id('dae06783-46c2-4b62-87c1-a914f5714d5f')

    print(jobinfo)

 

Also, whenever I pass asJob parameter "False" it throws error.

in wrapper  return func(self, *args, **kwargs)

 

But same thing I could do using Postman API. The only thing I'm trying to do is pass multiple ad groups to be imported using above script. But currently not able to do for a single ADgroup as well.

 

newADgroup = server.groups.create_AD_group(newgroup, asJob=True)

    print(newADgroup)

5 respuestas
0/9000
Prachi Dalvi ha preguntado en #Tableau Server

 I tried the Site Content DataSource on the Tableau server, but it shows that the site Content was last updated a day prior (06/11/2024 11:34 AM). I want something to show the live status of the data sources. for e.g. there were few data sources which were schedule and ran this morning.

2 respuestas
  1. 12 jun 2024, 17:56

    @Prachi Dalvi​ 

    Hi, you may use a python code like:

    #import os

    from datetime import datetime, timezone

    import datetime as DT

    import tableauserverclient as TSC

     

    PAT_NAME = 'yourtokenname'

    PAT_VALUE = '/5QvK8pKa/wg==:JAIzqJlHjCMx4tt1'

    SITE_NAME = 'yoursitename'

    SERVER = 'https://prod-useast-b.online.tableau.com'

     

    literal_date = DT.datetime(2000, 1, 1)

     

    tableau_auth = TSC.PersonalAccessTokenAuth(PAT_NAME,PAT_VALUE,site_id=SITE_NAME)

    #tableau_auth = TSC.TableauAuth(username, password, site_id='sitenameurl')

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

    with server.auth.sign_in(tableau_auth):

    print('Logged in')

    now = datetime.now(timezone.utc)

    print(now)

    datasources = [ds for ds in TSC.Pager(server.datasources) if (now-(ds.updated_at or literal_date)).days>=0 and ds.has_extracts]

    for ds in datasources:

    print((now-(ds.updated_at or now)).days, ds.name, ds.updated_at, ds.project_name)

    You would need to create a PAT and allow PAT to be used in your site:

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

     

    This code uses Tableau Server Client:

    https://tableau.github.io/server-client-python/docs/

     

    Change line 21 if you want to know datasources update more than x days ago. In this example I am using >=0 so every data source should be shown.

     

    Finally, I don't remember, but I am like 90% sure, times shown will be in UTC.

     

    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

I am using Import Wizard.

My CSV contains account and contact information. Header Row, 3 record rows. Each row contains the same account info but different contact info.

 

3 accounts are being created, each with 1 contact. 

 

#Import

1 respuesta
0/9000

I am using NPSP and have an Excel file that contains 3 contacts in a single row such as

 

name, email, address, name, email, address, relationship, name, email, address, relationship

 

The above is an example of a child with mother and father contacts and relationship field telling if it's father or mother.

 

I need to import this data into NPSP; in this case, the above 3 should go into the same household. It would need to create a household if it does not exist, or update if a new contact is there but the rest are already there.

 

What's the best to get this done?

 

#NPSP #Import

0/9000

first time I am using  salesforce iOS SDK, I need to upgrade SDK in one the existing project. I did run the pod install, I am getting error 

'SalesforceSDKCommon/SFLogger.h' file not found in @interface SFSDKMobileSyncLogger : SFLogger class

 

#import <SalesforceSDKCommon/SFLogger.h>

 

Podfile : - 

platform :ios, '14.0'

install! 'cocoapods', :disable_input_output_paths => true

use_modular_headers!

target 'SwiftEventApp' do

    source 'https://github.com/forcedotcom/SalesforceMobileSDK-iOS-Specs.git' # need to be first

    source 'https://github.com/CocoaPods/Specs.git'

    # Specify each pre-release pod

#    pod 'SalesforceSDKCore', :path => '/Users/Proj/SalesforceMobileSDK-iOS/'

#    pod 'SalesforceAnalytics', :path => '/Users/Proj/SalesforceMobileSDK-iOS/'

#    pod 'SmartStore', :path => /Users/Proj/SalesforceMobileSDK-iOS/'

#    pod 'MobileSync', :path => '/Users/Proj/SalesforceMobileSDK-iOS/'

pod 'MobileSync'

pod 'SmartStore'

pod 'SalesforceSDKCore'

end

1 respuesta
0/9000

I would like to know if I can execute a command line to automatically refresh all extracts in Tableau Desktop where the data source is from a 3rd party's Tableau Server.

 

Every morning I open a desktop workbook from a shared drive, connect to the 3rd party's tableau server and refresh all extracts. The extracts go to a local shared drive (same place as workbook) as hyper files. then I use a Prep flow to join, clean, etc. all the extracts and output to my Tableau Server.

 

I would like to automate the refresh of the extracts so that the final dashboards can be updated and subscriptions of reports needed can be sent on the weekends. Since it's manual process today, weekend data isn't available until Monday when I can manually run the process. I know I can schedule the Prep flow, but the first step of automatically running the extracts from the 3rd Party's server is my issue.

 

Can anyone help me with this?

4 respuestas
  1. 26 may 2021, 16:53

    @Debbie Andre​ 

    Ok, In this case, you can use the REST API to download the datasources. REST API have some functions devoloped for Python, but like I am old school, I like powershell. I find a module file for Powershell from Glen Robinson who has developed an awesome set of functions for Powershell. To use them, you only need to unzip the contents in a folder, and then use them in powershell.

     

    https://github.com/glenrobinson72/Tableau-Powershell-Scripts/tree/master/REST-API

     

    Next, you open Windows Powershell ISE, I created the following code, with is very easy to use:

     

    #Import the library where you saved it, i.e

    Import-Module "C:\Program Files\WindowsPowerShell\Modules\REST_API_Tableau\Tableau-REST_3_8.psm1" -Verbose

    ⌗For default site

    TS-Signin -server www.yourserver.com -username 'youruser' -password 'yourpassword' -protocol https -siteID ""

    ⌗For other site

    #TS-Signin -server www.yourserver.com -username 'youruser' -password 'yourpassword' -protocol https -siteID "yoursiteid"

    ⌗Download Data sources in zip. These contain the tds, and the hyper

    TS-DownloadDataSource -DatasourceName "Your Data Source 1" -ProjectName "Your Project" -FileName "D:\Where\you\savedatasource1.zip"

    TS-DownloadDataSource -DatasourceName "Your Data Source 2" -ProjectName "Your Project" -FileName "D:\Where\you\savedatasource2.zip"

    TS-DownloadDataSource -DatasourceName "Your Data Source 3" -ProjectName "Your Project" -FileName "D:\Where\you\savedatasource3.zip"

    TS-DownloadDataSource -DatasourceName "Your Data Source 4" -ProjectName "Your Project" -FileName "D:\Where\you\savedatasource4.zip"

    TS-DownloadDataSource -DatasourceName "Your Data Source 5" -ProjectName "Your Project" -FileName "D:\Where\you\savedatasource5.zip"

    #Signout

    TS-SignOut

    #Extract Zip files and overwrite if needed

    Expand-Archive -LiteralPath 'D:\Where\you\savedatasource1.zip' -DestinationPath "D:\Where\you\wantdirectoryextact1" -Force

    Expand-Archive -LiteralPath 'D:\Where\you\savedatasource2.zip' -DestinationPath "D:\Where\you\wanddirectoryextact2" -Force

    Expand-Archive -LiteralPath 'D:\Where\you\savedatasource3.zip' -DestinationPath "D:\Where\you\wantdirectoryextact3" -Force

    Expand-Archive -LiteralPath 'D:\Where\you\savedatasource4.zip' -DestinationPath "D:\Where\you\wantdirectoryextact4" -Force

    Expand-Archive -LiteralPath 'D:\Where\you\savedatasource5.zip' -DestinationPath "D:\Where\you\wantdirectoryextact5" -Force

    After that, in each of the extract path, you will find a data directory, with the hyper file. From there you could use Tableau Prep, or Tableau Hyper API, to upload the final result to your destination server.

     

    If this post resolves the question "Select as Best" or if it assists in resolving the question, please "Upvote". This will help other users find the same answer/resolution and help community keep track of answered questions. Thank you.

     

    Regards,

     

    Diego

0/9000