8000 Merge branch 'add_data_acceleration_and_data_freshness_policy_support… · ivanB1975/server-client-python@5b30e57 · GitHub
[go: up one dir, main page]

Skip to content

Commit 5b30e57

Browse files
committed
Merge branch 'add_data_acceleration_and_data_freshness_policy_support' of https://github.com/tableau/server-client-python into add_data_acceleration_and_data_freshness_policy_support
2 parents 5789e32 + 983e7c5 commit 5b30e57

File tree

2 files changed

+93
-1
lines changed

2 files changed

+93
-1
lines changed

samples/explore_workbook.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def main():
7272
# Pick one workbook from the list
7373
sample_workbook = all_workbooks[0]
7474
sample_workbook.name = "Name me something cooler"
75-
sample_workbook.description = "That doesn't work"
75+
# sample_workbook.description = "That doesn't work"
7676
updated: TSC.WorkbookItem = server.workbooks.update(sample_workbook)
7777
print(updated.name, updated.description)
7878

samples/updatewb.py

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
import tableauserverclient as TSC
2+
import logging
3+
from datetime import time
4+
5+
logging.basicConfig(format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", filename="tsc.log", level="DEBUG")
6+
tableau_auth = TSC.TableauAuth("test", "password")
7+
server = TSC.Server("localhost")
8+
server.version = "3.22"
9+
10+
with server.auth.sign_in(tableau_auth):
11+
all_workbooks, pagination_item = server.workbooks.get()
12+
wb1 = all_workbooks[2]
13+
print("\nThere are {} workbooks on site: ".format(len(all_workbooks)))
14+
# print(wb1.name)
15+
print([wb.name for wb in all_workbooks])
16+
17+
wb_details = server.workbooks.get_by_id(wb1.id)
18+
# views = wb_details.views
19+
# print(views[0].data_acceleration_config)
20+
print(wb_details.data_freshness_policy.option)
21+
# print(wb_details.data_freshness_policy.fresh_every_schedule.frequency)
22+
# print(wb_details.data_freshness_policy.fresh_every_schedule.value)
23+
24+
# wb1.name = "Superstore"
25+
# wb1.description = "Hmm"
26+
# dataacc = wb1.data_acceleration_config
27+
# print(dataacc)
28+
29+
# server.workbooks.populate_views(wb1)
30+
# print([vw.name for vw in wb1.views])
31+
# view1 = wb1.views[0]
32+
# wb1.views = [view1]
33+
# print([vw.name for vw in wb1.views])
34+
35+
# daconfig = dict()
36+
# daconfig['acceleration_enabled'] = True
37+
# daconfig['accelerate_now'] = True
38+
# wb1.data_acceleration_config = daconfig
39+
# print(wb1.data_acceleration_config)
40+
# server.workbooks.update(wb1, True)
41+
#
42+
# server.workbooks.populate_views(wb1)
43+
# view1 = wb1.views[0]
44+
45+
# wb1.data_freshness_policy = TSC.DataFreshnessPolicyItem(
46+
# TSC.DataFreshnessPolicyItem.Option.AlwaysLive)
47+
# wb1.data_freshness_policy = TSC.DataFreshnessPolicyItem(
48+
# TSC.DataFreshnessPolicyItem.Option.FreshEvery)
49+
# freshevery = TSC.DataFreshnessPolicyItem.FreshEveryItem(
50+
# TSC.DataFreshnessPolicyItem.FreshEveryItem.FreshEveryFrequency.Days,
51+
# 10
52+
# )
53+
# wb1.data_freshness_policy.fresh_every_schedule = freshevery
54+
55+
# wb1.data_freshness_policy = TSC.DataFreshnessPolicyItem(
56+
# TSC.DataFreshnessPolicyItem.Option.FreshAt)
57+
# time = "12:30:00"
58+
# freshat = TSC.DataFreshnessPolicyItem.FreshAtItem(
59+
# TSC.DataFreshnessPolicyItem.FreshAtItem.FreshAtFrequency.Day,
60+
# "12:30:00",
61+
# "America/Los_Angeles",
62+
# )
63+
weeklies = ["Monday", "Wednesday", TSC.IntervalItem.Day.Friday]
64+
65+
# monthlies = TSC.FreshAtMonthInterval(
66+
# 1,
67+
# )
68+
69+
# monthlies = TSC.DataFreshnessPolicyItem.FreshAt.FreshAtMonthInterval("1","25")
70+
# monthlies = ["LastDay"]
71+
# monthlies = ["1","30","25"]
72+
freshat = TSC.DataFreshnessPolicyItem.FreshAt(
73+
TSC.DataFreshnessPolicyItem.FreshAt.Frequency.Week, "12:00:00", "America/Los_Angeles", weeklies
74+
)
75+
wb1.data_freshness_policy = TSC.DataFreshnessPolicyItem(TSC.DataFreshnessPolicyItem.Option.FreshAt)
76+
wb1.data_freshness_policy.fresh_at_schedule = freshat
77+
#
78+
wb1 = server.workbooks.update(wb1)
79+
print(wb1.data_freshness_policy)
80+
# print(wb1.data_freshness_policy.fresh_every_schedule.frequency)
81+
# print(wb1.data_freshness_policy.fresh_every_schedule.value)
82+
83+
wb_details2 = server.workbooks.get_by_id(wb1.id)
84+
print(wb_details2.data_freshness_policy.fresh_at_schedule.frequency)
85+
print(wb_details2.data_freshness_policy.fresh_at_schedule.timezone)
86+
print(wb_details2.data_freshness_policy.fresh_at_schedule.time)
87+
weeklyinterval = wb_details2.data_freshness_policy.fresh_at_schedule.interval_item
88+
print(weeklyinterval)
89+
# print(weeklyinterval.interval)
90+
91+
# print([wb.name for wb in all_workbooks])
92+
# print(wb1.data_acceleration_config)

0 commit comments

Comments
 (0)
0