From 34b35ccc3957e31f2a610e9d6b6f56d530a6c7a6 Mon Sep 17 00:00:00 2001 From: Bryant Howell Date: Wed, 11 Dec 2019 14:51:50 -0600 Subject: [PATCH] This will be 5.1 because of new objects and logger improvements (and who knows what else) --- setup.py | 2 +- tableau_documents/table_relations.py | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index a0bbebc..9b6ca90 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,7 @@ setup( name='tableau_tools', python_requires='>=3.6', - version='5.0.7', + version='5.1.0', packages=['tableau_tools', 'tableau_tools.tableau_rest_api', 'tableau_tools.tableau_documents', 'tableau_tools.examples', 'tableau_tools.tableau_rest_api.methods'], url='https://github.com/bryantbhowell/tableau_tools', diff --git a/tableau_documents/table_relations.py b/tableau_documents/table_relations.py index c4b998a..c1ea942 100644 --- a/tableau_documents/table_relations.py +++ b/tableau_documents/table_relations.py @@ -3,8 +3,10 @@ import random from xml.sax.saxutils import quoteattr, unescape import copy +import datetime -from tableau_tools.tableau_exceptions import * +from ..tableau_exceptions import * +from ..tableau_rest_xml import TableauRestXml # This represents the classic Tableau data connection window relations # Allows for changes in JOINs, Stored Proc values, and Custom SQL @@ -17,8 +19,8 @@ def __init__(self, relation_xml_obj: ET.Element): self.main_table: ET.Element self.table_relations: List[ET.Element] self.join_relations = [] - self.ns_map = {"user": 'http://www.tableausoftware.com/xml/user', 't': 'http://tableau.com/api'} - ET.register_namespace('t', self.ns_map['t']) + #self.ns_map = {"user": 'http://www.tableausoftware.com/xml/user', 't': 'http://tableau.com/api'} + #ET.register_namespace('t', self.ns_map['t']) self._read_existing_relations() def _read_existing_relations(self): @@ -29,7 +31,7 @@ def _read_existing_relations(self): self.table_relations = [self.relation_xml_obj, ] else: - table_relations = self.relation_xml_obj.findall('.//relation', self.ns_map) + table_relations = self.relation_xml_obj.findall('.//relation', TableauRestXml.ns_map) final_table_relations = [] # ElementTree doesn't implement the != operator, so have to find all then iterate through to exclude # the JOINs to only get the tables, stored-procs and Custom SQLs @@ -118,7 +120,7 @@ def set_stored_proc_parameter_value_by_name(self, parameter_name: str, parameter if self._stored_proc_parameters_xml is None: self._stored_proc_parameters_xml = ET.Element('actual-parameters') # Find parameter with that name (if exists) - param = self._stored_proc_parameters_xml.find('.//column[@name="{}"]'.format(parameter_name), self.ns_map) + param = self._stored_proc_parameters_xml.find('.//column[@name="{}"]'.format(parameter_name), TableauRestXml.ns_map) if param is None: # create_stored... already converts to correct quoting