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
SELECT | |
hvc.customer_id | |
, total_revenue | |
, days_since_first_seen | |
FROM ( | |
SELECT | |
customer_id | |
, SUM(total_revenue) AS total_revenue | |
FROM transaction_details td | |
LEFT JOIN customer_details cd |
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 high_value_customers AS ( | |
SELECT | |
customer_id | |
, SUM(total_revenue) AS total_revenue | |
FROM transaction_details td | |
LEFT JOIN customer_details cd | |
ON td.card_id = cd.card_id | |
GROUP BY 1 | |
ORDER BY 2 DESC | |
HAVING total_revenue > 500 |
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.sample import sample_config | |
from tableau_api_lib.utils import querying, flatten_dict_column, flatten_dict_list_column | |
# sample config | |
tableau_server_config = { | |
'tableau_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 tableau_api_lib import TableauServerConnection | |
from tableau_api_lib.sample import sample_config | |
from tableau_api_lib.utils import querying, flatten_dict_column, flatten_dict_list_column | |
# sample config | |
tableau_server_config = { | |
'tableau_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 tableau_api_lib import TableauServerConnection | |
from tableau_api_lib.sample import sample_config | |
from tableau_api_lib.utils import querying | |
from tableau_api_lib.utils.common import flatten_dict_column | |
# sample config | |
tableau_server_config = { |
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 import querying, flatten_dict_column | |
# using personal access tokens is preferred; otherwise, comment those details out and use username / password | |
tableau_server_config = { | |
'my_env': { | |
'server': 'https://10ax.online.tableau.com', # replace with your own server |
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 | |
from tableau_api_lib.utils.querying import get_sites_dataframe | |
# using personal access tokens is preferred; otherwise, comment those details out and use username / password | |
tableau_server_config = { |
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 | |
from tableau_api_lib.utils.querying import get_sites_dataframe | |
# using personal access tokens is preferred; otherwise, comment those details out and use username / password | |
tableau_server_config = { |
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 | |
from tableau_api_lib.utils.querying import get_projects_dataframe | |
from tableauhyperapi import HyperProcess, Connection, TableDefinition, SqlType, Telemetry, Inserter, CreateMode, TableName |
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
# this code snippet will not run by itself; this is a piece of a larger workflow. | |
# a Pandas DataFrame named 'combined_df' is the source of data in this example | |
PATH_TO_HYPER = 'workbooks_and_owners.hyper' | |
# Step 1: Start a new private local Hyper instance | |
with HyperProcess(Telemetry.SEND_USAGE_DATA_TO_TABLEAU, 'myapp' ) as hyper: | |
# Step 2: Create the the .hyper file, replace it if it already exists | |
with Connection(endpoint=hyper.endpoint, |
NewerOlder