diff --git a/tableaudocumentapi/datasource.py b/tableaudocumentapi/datasource.py
index 69318ed..7f60829 100644
--- a/tableaudocumentapi/datasource.py
+++ b/tableaudocumentapi/datasource.py
@@ -101,7 +101,9 @@ def __init__(self, datasource_xml, version):
self._dsversion = version
def _extract_federated_connections(self):
- return list(map(Connection, self._dsxml.findall('.//named-connections/named-connection/*')))
+ connections = list(map(Connection, self._dsxml.findall('.//named-connections/named-connection/*')))
+ connections.extend(map(Connection, self._dsxml.findall("./connection[@class='sqlproxy']")))
+ return connections
def _extract_legacy_connection(self):
return list(map(Connection, self._dsxml.findall('connection')))
diff --git a/test/assets/multiple_connections.twb b/test/assets/multiple_connections.twb
new file mode 100644
index 0000000..0bdc774
--- /dev/null
+++ b/test/assets/multiple_connections.twb
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/bvt.py b/test/bvt.py
index 60e42c3..57eead6 100644
--- a/test/bvt.py
+++ b/test/bvt.py
@@ -27,6 +27,9 @@
EMPTY_WORKBOOK = os.path.join(TEST_DIR, 'assets', 'empty_workbook.twb')
+MULTI_CONNECTION_10 = os.path.join(
+ TEST_DIR, 'assets', 'multiple_connections.twb')
+
class ConnectionParserTests(unittest.TestCase):
@@ -94,6 +97,26 @@ def test_can_create_datasource_from_connections(self):
self.assertEqual(ds.connections[1].server, '1')
+class ConnectionParserInComplicatedWorkbooks(unittest.TestCase):
+
+ def setUp(self):
+ with open(MULTI_CONNECTION_10, 'rb') as in_file, open('test.twb', 'wb') as out_file:
+ out_file.write(in_file.read())
+ self.twb_file = out_file
+
+ def tearDown(self):
+ self.twb_file.close()
+ os.unlink(self.twb_file.name)
+
+ def test_can_mixed_connections_workbook(self):
+ wb = Workbook(self.twb_file.name)
+ self.assertTrue(len(wb.datasources), 2)
+ self.assertTrue(len(wb.datasources[1].connections), 2)
+ self.assertEqual(wb.datasources[0].connections[0].dbclass, 'sqlproxy')
+ self.assertEqual(wb.datasources[1].connections[0].dbclass, 'mysql')
+ self.assertEqual(wb.datasources[1].connections[1].dbclass, 'sqlserver')
+
+
class DatasourceModelTests(unittest.TestCase):
def setUp(self):
pFad - Phonifier reborn
Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies:
Alternative Proxy
pFad Proxy
pFad v3 Proxy
pFad v4 Proxy