This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AuthEndpoint(BaseEndpoint): | |
""" | |
Authorization endpoint for Tableau Server API requests. | |
:param ts_connection: The Tableau Server connection object. | |
:type ts_connection: class | |
:param sign_in: Boolean flag; True if signing in, False otherwise. | |
:type sign_in: boolean | |
:param sign_out: Boolean flag; True if signing out, False otherwise. | |
:type sign_out: boolean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import json | |
import requests | |
from requests.packages.urllib3.fields import RequestField | |
from requests.packages.urllib3.filepost import encode_multipart_formdata | |
def _make_multipart(parts): | |
mime_multipart_parts = [] | |
for name, (filename, blob, content_type) in parts.items(): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tableau_api_lib import TableauServerConnection | |
from tableau_api_lib.utils.querying import get_groups_dataframe, get_group_users_dataframe, get_schedules_dataframe, \ | |
get_subscriptions_dataframe | |
TEST_GROUP_ID = '<YOUR_GROUP_ID>' | |
TEST_SCHEDULE_ID = '<YOUR_SCHEDULE_ID>' | |
TEST_CONTENT_ID = '<YOUR_VIEW_ID>' | |
TEST_CONTENT_TYPE = 'view' # in this tutorial, my subscription is for a Tableau view | |
TEST_SUBSCRIPTION_SUBJECT = '<YOUR_SUBSCRIPTION_SUBJECT>' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tableau_api_lib import TableauServerConnection | |
from tableau_api_lib.utils.querying import get_users_dataframe, get_sites_dataframe | |
SITE_NAME_TEXT = '<YOUR_OPTIONAL_SITE_NAME_TEXT>' | |
TABLEAU_SERVER_CONFIG = { | |
'my_env': { | |
'server': 'https://YourTableauServer.com', | |
'api_version': '<YOUR_API_VERSION>', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tableau_api_lib import TableauServerConnection | |
from tableau_api_lib.utils.querying import get_schedules_dataframe | |
from tableau_api_lib.utils.cloning import clone_schedules | |
TABLEAU_SERVER_CONFIG = { | |
'my_env': { | |
'server': 'https://<YOUR_SERVER>.com', | |
'api_version': '<YOUR_API_VERSION>', | |
'username': '<YOUR_USERNAME>', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from tableauhyperapi import HyperProcess, Connection, TableDefinition, SqlType, Telemetry, Inserter, CreateMode, TableName | |
from tableauhyperapi import escape_string_literal | |
PATH_TO_CSV = 'sample_csv_for_hyper.csv' | |
PATH_TO_HYPER = 'test_hyper_extract_api.hyper' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from tableau_api_lib import TableauServerConnection | |
from tableau_api_lib.utils.querying import get_sites_dataframe | |
SITE_NAMES = None # if this variable is None then all sites will be queried | |
# uncomment the line below if defining a subset of sites | |
# SITE_NAMES = ['SiteA', 'SiteB', 'SiteC'] # optional variable to define a subset of sites |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tableau_api_lib import TableauServerConnection | |
from tableau_api_lib.utils.querying import get_webhooks_dataframe | |
tableau_server_config = { | |
'my_env': { | |
'server': 'https://YourTableauServer.com', | |
'api_version': '<YOUR_API_VERSION>', | |
'username': '<YOUR_USERNAME>', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH events AS ( | |
SELECT DISTINCT MAX(DATE_TRUNC('day', created_at)) AS last_interaction_date | |
, hist_target_site_id | |
, hist_workbook_id | |
, hist_datasource_id | |
, hist_flow_id | |
, historical_event_type_id | |
FROM historical_events | |
GROUP BY 2, 3, 4, 5, 6 | |
), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from sqlalchemy import create_engine # make sure you also have the psycopg2 package installed via pip | |
pg_config = { | |
'host': '<YOUR_HOST_NAME>', | |
'port': '8060', | |
'database': 'workgroup', | |
'username': 'readonly', | |
'password': '<YOUR_PASSWORD>' |
OlderNewer