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 sqlalchemy import create_engine | |
import pandas as pd | |
from pandas.io.json import json_normalize | |
from tableau_api_lib import TableauServerConnection | |
from tableau_api_lib.utils import flatten_dict_column, flatten_dict_list_column | |
# using personal access tokens is preferred; otherwise, comment those details out and use username / password |
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_view_id | |
, historical_event_type_id | |
FROM historical_events | |
GROUP BY 2, 3, 4 | |
), | |
event_types AS ( | |
SELECT DISTINCT type_id |
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 pandas.io.json import json_normalize | |
from tableau_api_lib import TableauServerConnection | |
from tableau_api_lib.utils import flatten_dict_column, flatten_dict_list_column | |
# using personal access tokens is preferred; otherwise, comment those details out and use username / password | |
tableau_server_config = { | |
'my_env': { |
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 pandas.io.json import json_normalize | |
from tableau_api_lib import TableauServerConnection | |
from tableau_api_lib.utils import flatten_dict_column, flatten_dict_list_column | |
# using personal access tokens is preferred; otherwise, comment those details out and use username / password | |
tableau_server_config = { | |
'my_env': { |
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
# workbooks | |
{ | |
workbooks { | |
workbook_name: name | |
workbook_id: luid | |
workbook_project: projectName | |
views { | |
view_type: __typename | |
view_name: name |
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>' |
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
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
from tableau_api_lib import TableauServerConnection | |
from tableau_api_lib.utils.querying import get_workbooks_dataframe, get_datasources_dataframe | |
TS_CONFIG = { | |
'my_env': { | |
'server': 'https://YourTableauServer.com', | |
'api_version': '<YOUR_API_VERSION>', | |
'username': '<YOUR_USERNAME>', | |
'password': '<YOUR_PASSWORD>', |
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_projects_dataframe | |
# Set the following constants according to your environment | |
YOUR_PROJECT_ID = 'ENTER_YOUR_TS_PROJECT_ID' | |
YOUR_WORKBOOK_FILE_PATH = 'ENTER_YOUR_WORKBOOK_FILE_PATH' | |
YOUR_WORKBOOK_NAME = 'ENTER_YOUR_DESIRED_WORKBOOK_NAME' | |
YOUR_TABLEAU_SERVER_ADDRESS = 'ENTER_YOUR_TABLEAU_SERVER_ADDRESS' | |
YOUR_DB_SERVER_ADDRESS = 'ENTER_YOUR_DB_SERVER_ADDRESS' |