Skip to content

Commit f216a5e

Browse files
author
Bryant Howell
authored
Merge pull request #77 from bryantbhowell/5.0.6
5.0.6
2 parents 69aad71 + 3e76213 commit f216a5e

File tree

13 files changed

+36
-17
lines changed

13 files changed

+36
-17
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ If you just import tableau_tools per the following, you will have access to the
153153
If you need to use tableau_documents, use the following import statements:
154154

155155
from tableau_tools import *
156-
from tableau_documents import *
156+
from tableau_tools.tableau_documents import *
157157

158158
### 0.2 Logger class
159159
The Logger class implements useful and verbose logging to a plain text file that all of the other objects can use. You declare a single Logger object, then pass it to the other objects, resulting in a single continuous log file of all actions.

__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,3 @@
88
#from .tableau._server_rest import TableauServerRest, TableauServerRest33
99
from .tableau_rest_api_connection import *
1010
from .tableau_server_rest import *
11-
import tableau_documents

examples/hyper_api_samples.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22
from tableau_tools import *
3-
from tableau_documents import *
4-
from tableau_documents.hyper_file_generator import HyperFileGenerator
3+
from tableau_tools.tableau_documents import *
4+
from tableau_tools.tableau_documents.hyper_file_generator import HyperFileGenerator
55

66
import pyodbc
77
import sys

examples/replicate_site_structure_sample.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22

33
from tableau_tools import *
4-
from tableau_documents import *
4+
from tableau_tools.tableau_documents import *
55
import time
66
import os
77

examples/template_publish_sample.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22

33
from tableau_tools import *
4-
from tableau_documents import *
4+
from tableau_tools.tableau_documents import *
55

66
import datetime
77
import os
@@ -90,6 +90,22 @@ def promote_from_dev_to_test(logger_obj=None):
9090

9191
# promote_from_dev_to_test(logger)
9292

93+
# This function shows changing out a Hyper file in an existing packaged workbook
94+
# It assumes you have used the Hyper API at least once to generate a Hyper file, then used Tableau Desktop to connect
95+
# to that Hyper file, and saved a packaged file (TWBX or TDSX) with that file
96+
def hyper_api_swap_example(logger_obj = None):
97+
newly_built_hyper_filename = 'Replacement Hyper File.hyper'
98+
t_file = TableauFileManager.open(filename='Packaged File.tdsx', logger_obj=logger_obj)
99+
filenames = t_file.get_filenames_in_package()
100+
for filename in filenames:
101+
# Find my Hyper file
102+
if filename.lower.find('.hyper') != -1:
103+
t_file.set_file_for_replacement(filename_in_package=filename,
104+
replacement_filname_on_disk=newly_built_hyper_filename)
105+
break # Breaking here on a TDSX, but you could do a whole mapping I suppose to replace multiples in a TDSX
106+
107+
t_file.save_new_file(new_filename_no_extension='Updated Packaged File')
108+
93109
# This function shows publishing multiple workbooks from a single project
94110
# which will also publish across any published data sources that are linked
95111
# This is a complex algorithm but is necessary for working with published data sources

examples/test_suite_tableau_documents.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from tableau_tools import *
2-
from tableau_documents import *
2+
from tableau_tools.tableau_documents import *
33

44
#
55
# WIP and will be more fully built out in the future. See template_publish_sample.py for other uses as well as the README

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
setup(
44
name='tableau_tools',
55
python_requires='>=3.6',
6-
version='5.0.4',
7-
packages=['tableau_tools', 'tableau_tools.tableau_rest_api', 'tableau_tools.tableau_documents', 'tableau_tools.examples'],
6+
version='5.0.6',
7+
packages=['tableau_tools', 'tableau_tools.tableau_rest_api', 'tableau_tools.tableau_documents',
8+
'tableau_tools.examples', 'tableau_tools.tableau_rest_api.methods'],
89
url='https://github.com/bryantbhowell/tableau_tools',
910
license='',
1011
author='Bryant Howell',

tableau_documents/tableau_columns.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from tableau_tools.logger import Logger
88
from tableau_tools.logging_methods import LoggingMethods
99

10-
from tableau_documents.tableau_parameters import TableauParameter
10+
from .tableau_parameters import TableauParameter
1111

1212

1313
class TableauColumns(LoggingMethods):

tableau_documents/tableau_datasource.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
from tableau_tools.tableau_exceptions import *
1111
from tableau_tools.logger import Logger
1212
from tableau_tools.logging_methods import LoggingMethods
13-
from tableau_documents.tableau_connection import TableauConnection
14-
from tableau_documents.tableau_document import TableauDocument
15-
from tableau_documents.tableau_columns import TableauColumns
16-
from tableau_documents.table_relations import TableRelations
13+
from .tableau_connection import TableauConnection
14+
from .tableau_document import TableauDocument
15+
from .tableau_columns import TableauColumns
16+
from .table_relations import TableRelations
1717

1818

1919
# Meant to represent a TDS file, does not handle the file opening

tableau_documents/tableau_parameters.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ def __init__(self, parameter_xml: Optional[ET.Element] = None, parameter_number:
1515
logger_obj: Optional[Logger] = None, name: Optional[str] = None, datatype: Optional[str] = None,
1616
current_value: Optional[str] = None):
1717

18-
TableauBase.__init__(self)
1918
self.logger = logger_obj
2019
self._aliases = False
2120
self._values_list = None

0 commit comments

Comments
 (0)