Skip to content

Commit

Permalink
Merge pull request #74 from bryantbhowell/5.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Bryant Howell authored Dec 8, 2019
2 parents e6c8f1c + 6eba3c5 commit 1ca6b9a
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 20 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
setup(
name='tableau_tools',
python_requires='>=3.6',
version='5.0.2',
version='5.0.3',
packages=['tableau_tools', 'tableau_tools.tableau_rest_api', 'tableau_tools.tableau_documents', 'tableau_tools.examples'],
url='https://github.com/bryantbhowell/tableau_tools',
license='',
Expand Down
9 changes: 5 additions & 4 deletions tabcmd.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import json
import urllib.request, urllib.parse, urllib.error
import xml.etree.ElementTree as ET
import os

from .tableau_rest_api.tableau_rest_api_connection import *
from tableau_tools.tableau_repository import *
from tableau_tools.tableau_http import *
from tableau_tools.tableau_base import TableauBase
from .tableau_http import *
from .logger import Logger
from .logging_methods import LoggingMethods


class Tabcmd(TableauBase):
class Tabcmd(LoggingMethods):
def __init__(self, tabcmd_folder, tableau_server_url, username, password, site='default',
repository_password=None, tabcmd_config_location=None):
super(self.__class__, self).__init__()
Expand Down
35 changes: 20 additions & 15 deletions tableau_documents/tableau_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,34 +26,39 @@ def cols(self) -> ET.Element:

@property
def dbname(self) -> Optional[str]:
# Looks for schema tag as well in case it's an Oracle system
if self.xml_obj.get('dbname'):
return self.xml_obj.get('dbname')
elif self.xml_obj.get('schema'):
# Looks for schema tag as well in case it's an Oracle system (potentially others)
if self.connection_type in ['oracle', ]:
return self.xml_obj.get('schema')
elif self.xml_obj.get('dbname'):
return self.xml_obj.get('dbname')
else:
return None

@dbname.setter
def dbname(self, new_db_name: str):
if self.xml_obj.get("dbname") is not None:
self.xml_obj.attrib["dbname"] = new_db_name
elif self.xml_obj.get('schema') is not None:
self.xml_obj.attrib['schema'] = new_db_name
# Potentially could be others with the oracle issue, for later
if self.connection_type in ['oracle', ]:
self.xml_obj.set('schema', new_db_name)
else:
if self.connection_type == 'oracle':
self.xml_obj.set('schema', new_db_name)
else:
self.xml_obj.set('dbname', new_db_name)
self.xml_obj.set('dbname', new_db_name)

@property
def schema(self) -> Optional[str]:
# dbname already handles this for Oracle, just here for the heck of it
return self.dbname

if self.xml_obj.get("schema") is not None:
return self.xml_obj.get('schema')
# This is just in case you are trying schema with dbname only type database
else:
return self.xml_obj.get('dbname')

@schema.setter
def schema(self, new_schema: str):
self.dbname = new_schema
if self.xml_obj.get("schema") is not None:
self.xml_obj.set('schema', new_schema)
# This is just in case you are trying schema with dbname only type database
else:
self.dbname = new_schema


@property
def server(self) -> str:
Expand Down

0 comments on commit 1ca6b9a

Please sign in to comment.