Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
olapy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
olapy
Commits
c43be567
Commit
c43be567
authored
May 03, 2017
by
mouadh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid consecutive if-statements
parent
d9973b89
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
501 additions
and
494 deletions
+501
-494
olapy/core/services/xmla_discover_tools.py
olapy/core/services/xmla_discover_tools.py
+501
-494
No files found.
olapy/core/services/xmla_discover_tools.py
View file @
c43be567
...
@@ -1520,149 +1520,152 @@ class XmlaDiscoverTools():
...
@@ -1520,149 +1520,152 @@ class XmlaDiscoverTools():
"""
)
"""
)
def
discover_literals_response
(
self
,
request
):
def
discover_literals_response
(
self
,
request
):
if
request
.
Properties
.
PropertyList
.
Content
==
'SchemaData'
:
if
request
.
Properties
.
PropertyList
.
Content
==
'SchemaData'
\
if
request
.
Properties
.
PropertyList
.
Format
==
'Tabular'
:
and
request
.
Properties
.
PropertyList
.
Format
==
'Tabular'
:
return
etree
.
fromstring
(
"""
<return>
return
etree
.
fromstring
(
"""
<root xmlns="urn:schemas-microsoft-com:xml-analysis:rowset"
<return>
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
<root xmlns="urn:schemas-microsoft-com:xml-analysis:rowset"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
"""
+
discover_literals_xsd
+
"""
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<row>
"""
+
discover_literals_xsd
+
"""
<LiteralName>DBLITERAL_CATALOG_NAME</LiteralName>
<row>
<LiteralInvalidChars>.</LiteralInvalidChars>
<LiteralName>DBLITERAL_CATALOG_NAME</LiteralName>
<LiteralInvalidStartingChars>0123456789</LiteralInvalidStartingChars>
<LiteralInvalidChars>.</LiteralInvalidChars>
<LiteralMaxLength>24</LiteralMaxLength>
<LiteralInvalidStartingChars>0123456789</LiteralInvalidStartingChars>
<LiteralNameEnumValue>2</LiteralNameEnumValue>
<LiteralMaxLength>24</LiteralMaxLength>
</row>
<LiteralNameEnumValue>2</LiteralNameEnumValue>
<row>
</row>
<LiteralName>DBLITERAL_CATALOG_SEPARATOR</LiteralName>
<row>
<LiteralValue>.</LiteralValue>
<LiteralName>DBLITERAL_CATALOG_SEPARATOR</LiteralName>
<LiteralMaxLength>0</LiteralMaxLength>
<LiteralValue>.</LiteralValue>
<LiteralNameEnumValue>3</LiteralNameEnumValue>
<LiteralMaxLength>0</LiteralMaxLength>
</row>
<LiteralNameEnumValue>3</LiteralNameEnumValue>
<row>
</row>
<LiteralName>DBLITERAL_COLUMN_ALIAS</LiteralName>
<row>
<LiteralInvalidChars>'"[]</LiteralInvalidChars>
<LiteralName>DBLITERAL_COLUMN_ALIAS</LiteralName>
<LiteralInvalidStartingChars>0123456789</LiteralInvalidStartingChars>
<LiteralInvalidChars>'"[]</LiteralInvalidChars>
<LiteralMaxLength>-1</LiteralMaxLength>
<LiteralInvalidStartingChars>0123456789</LiteralInvalidStartingChars>
<LiteralNameEnumValue>5</LiteralNameEnumValue>
<LiteralMaxLength>-1</LiteralMaxLength>
</row>
<LiteralNameEnumValue>5</LiteralNameEnumValue>
<row>
</row>
<LiteralName>DBLITERAL_COLUMN_NAME</LiteralName>
<row>
<LiteralInvalidChars>.</LiteralInvalidChars>
<LiteralName>DBLITERAL_COLUMN_NAME</LiteralName>
<LiteralInvalidStartingChars>0123456789</LiteralInvalidStartingChars>
<LiteralInvalidChars>.</LiteralInvalidChars>
<LiteralMaxLength>-1</LiteralMaxLength>
<LiteralInvalidStartingChars>0123456789</LiteralInvalidStartingChars>
<LiteralNameEnumValue>6</LiteralNameEnumValue>
<LiteralMaxLength>-1</LiteralMaxLength>
</row>
<LiteralNameEnumValue>6</LiteralNameEnumValue>
<row>
</row>
<LiteralName>DBLITERAL_CORRELATION_NAME</LiteralName>
<row>
<LiteralInvalidChars>'"[]</LiteralInvalidChars>
<LiteralName>DBLITERAL_CORRELATION_NAME</LiteralName>
<LiteralInvalidStartingChars>0123456789</LiteralInvalidStartingChars>
<LiteralInvalidChars>'"[]</LiteralInvalidChars>
<LiteralMaxLength>-1</LiteralMaxLength>
<LiteralInvalidStartingChars>0123456789</LiteralInvalidStartingChars>
<LiteralNameEnumValue>7</LiteralNameEnumValue>
<LiteralMaxLength>-1</LiteralMaxLength>
</row>
<LiteralNameEnumValue>7</LiteralNameEnumValue>
<row>
</row>
<LiteralName>DBLITERAL_CUBE_NAME</LiteralName>
<row>
<LiteralInvalidChars>.</LiteralInvalidChars>
<LiteralName>DBLITERAL_CUBE_NAME</LiteralName>
<LiteralInvalidStartingChars>0123456789</LiteralInvalidStartingChars>
<LiteralInvalidChars>.</LiteralInvalidChars>
<LiteralMaxLength>-1</LiteralMaxLength>
<LiteralInvalidStartingChars>0123456789</LiteralInvalidStartingChars>
<LiteralNameEnumValue>21</LiteralNameEnumValue>
<LiteralMaxLength>-1</LiteralMaxLength>
</row>
<LiteralNameEnumValue>21</LiteralNameEnumValue>
<row>
</row>
<LiteralName>DBLITERAL_DIMENSION_NAME</LiteralName>
<row>
<LiteralInvalidChars>.</LiteralInvalidChars>
<LiteralName>DBLITERAL_DIMENSION_NAME</LiteralName>
<LiteralInvalidStartingChars>0123456789</LiteralInvalidStartingChars>
<LiteralInvalidChars>.</LiteralInvalidChars>
<LiteralMaxLength>-1</LiteralMaxLength>
<LiteralInvalidStartingChars>0123456789</LiteralInvalidStartingChars>
<LiteralNameEnumValue>22</LiteralNameEnumValue>
<LiteralMaxLength>-1</LiteralMaxLength>
</row>
<LiteralNameEnumValue>22</LiteralNameEnumValue>
<row>
</row>
<LiteralName>DBLITERAL_HIERARCHY_NAME</LiteralName>
<row>
<LiteralInvalidChars>.</LiteralInvalidChars>
<LiteralName>DBLITERAL_HIERARCHY_NAME</LiteralName>
<LiteralInvalidStartingChars>0123456789</LiteralInvalidStartingChars>
<LiteralInvalidChars>.</LiteralInvalidChars>
<LiteralMaxLength>-1</LiteralMaxLength>
<LiteralInvalidStartingChars>0123456789</LiteralInvalidStartingChars>
<LiteralNameEnumValue>23</LiteralNameEnumValue>
<LiteralMaxLength>-1</LiteralMaxLength>
</row>
<LiteralNameEnumValue>23</LiteralNameEnumValue>
<row>
</row>
<LiteralName>DBLITERAL_LEVEL_NAME</LiteralName>
<row>
<LiteralInvalidChars>.</LiteralInvalidChars>
<LiteralName>DBLITERAL_LEVEL_NAME</LiteralName>
<LiteralInvalidStartingChars>0123456789</LiteralInvalidStartingChars>
<LiteralInvalidChars>.</LiteralInvalidChars>
<LiteralMaxLength>-1</LiteralMaxLength>
<LiteralInvalidStartingChars>0123456789</LiteralInvalidStartingChars>
<LiteralNameEnumValue>24</LiteralNameEnumValue>
<LiteralMaxLength>-1</LiteralMaxLength>
</row>
<LiteralNameEnumValue>24</LiteralNameEnumValue>
<row>
</row>
<LiteralName>DBLITERAL_MEMBER_NAME</LiteralName>
<row>
<LiteralInvalidChars>.</LiteralInvalidChars>
<LiteralName>DBLITERAL_MEMBER_NAME</LiteralName>
<LiteralInvalidStartingChars>0123456789</LiteralInvalidStartingChars>
<LiteralInvalidChars>.</LiteralInvalidChars>
<LiteralMaxLength>-1</LiteralMaxLength>
<LiteralInvalidStartingChars>0123456789</LiteralInvalidStartingChars>
<LiteralNameEnumValue>25</LiteralNameEnumValue>
<LiteralMaxLength>-1</LiteralMaxLength>
</row>
<LiteralNameEnumValue>25</LiteralNameEnumValue>
<row>
</row>
<LiteralName>DBLITERAL_PROCEDURE_NAME</LiteralName>
<row>
<LiteralInvalidChars>.</LiteralInvalidChars>
<LiteralName>DBLITERAL_PROCEDURE_NAME</LiteralName>
<LiteralInvalidStartingChars>0123456789</LiteralInvalidStartingChars>
<LiteralInvalidChars>.</LiteralInvalidChars>
<LiteralMaxLength>-1</LiteralMaxLength>
<LiteralInvalidStartingChars>0123456789</LiteralInvalidStartingChars>
<LiteralNameEnumValue>14</LiteralNameEnumValue>
<LiteralMaxLength>-1</LiteralMaxLength>
</row>
<LiteralNameEnumValue>14</LiteralNameEnumValue>
<row>
</row>
<LiteralName>DBLITERAL_PROPERTY_NAME</LiteralName>
<row>
<LiteralInvalidChars>.</LiteralInvalidChars>
<LiteralName>DBLITERAL_PROPERTY_NAME</LiteralName>
<LiteralInvalidStartingChars>0123456789</LiteralInvalidStartingChars>
<LiteralInvalidChars>.</LiteralInvalidChars>
<LiteralMaxLength>-1</LiteralMaxLength>
<LiteralInvalidStartingChars>0123456789</LiteralInvalidStartingChars>
<LiteralNameEnumValue>26</LiteralNameEnumValue>
<LiteralMaxLength>-1</LiteralMaxLength>
</row>
<LiteralNameEnumValue>26</LiteralNameEnumValue>
<row>
</row>
<LiteralName>DBLITERAL_QUOTE_PREFIX</LiteralName>
<row>
<LiteralValue>[</LiteralValue>
<LiteralName>DBLITERAL_QUOTE_PREFIX</LiteralName>
<LiteralMaxLength>-1</LiteralMaxLength>
<LiteralValue>[</LiteralValue>
<LiteralNameEnumValue>15</LiteralNameEnumValue>
<LiteralMaxLength>-1</LiteralMaxLength>
</row>
<LiteralNameEnumValue>15</LiteralNameEnumValue>
<row>
</row>
<LiteralName>DBLITERAL_QUOTE_SUFFIX</LiteralName>
<row>
<LiteralValue>]</LiteralValue>
<LiteralName>DBLITERAL_QUOTE_SUFFIX</LiteralName>
<LiteralMaxLength>-1</LiteralMaxLength>
<LiteralValue>]</LiteralValue>
<LiteralNameEnumValue>28</LiteralNameEnumValue>
<LiteralMaxLength>-1</LiteralMaxLength>
</row>
<LiteralNameEnumValue>28</LiteralNameEnumValue>
<row>
</row>
<LiteralName>DBLITERAL_TABLE_NAME</LiteralName>
<row>
<LiteralInvalidChars>.</LiteralInvalidChars>
<LiteralName>DBLITERAL_TABLE_NAME</LiteralName>
<LiteralInvalidStartingChars>0123456789</LiteralInvalidStartingChars>
<LiteralInvalidChars>.</LiteralInvalidChars>
<LiteralMaxLength>-1</LiteralMaxLength>
<LiteralInvalidStartingChars>0123456789</LiteralInvalidStartingChars>
<LiteralNameEnumValue>17</LiteralNameEnumValue>
<LiteralMaxLength>-1</LiteralMaxLength>
</row>
<LiteralNameEnumValue>17</LiteralNameEnumValue>
<row>
</row>
<LiteralName>DBLITERAL_TEXT_COMMAND</LiteralName>
<row>
<LiteralMaxLength>-1</LiteralMaxLength>
<LiteralName>DBLITERAL_TEXT_COMMAND</LiteralName>
<LiteralNameEnumValue>18</LiteralNameEnumValue>
<LiteralMaxLength>-1</LiteralMaxLength>
</row>
<LiteralNameEnumValue>18</LiteralNameEnumValue>
<row>
</row>
<LiteralName>DBLITERAL_USER_NAME</LiteralName>
<row>
<LiteralMaxLength>0</LiteralMaxLength>
<LiteralName>DBLITERAL_USER_NAME</LiteralName>
<LiteralNameEnumValue>19</LiteralNameEnumValue>
<LiteralMaxLength>0</LiteralMaxLength>
</row>
<LiteralNameEnumValue>19</LiteralNameEnumValue>
</root>
</row>
</return>
</root>
</return>
"""
)
"""
)
def
discover_mdschema_sets_response
(
self
,
request
):
def
discover_mdschema_sets_response
(
self
,
request
):
if
request
.
Restrictions
.
RestrictionList
.
CUBE_NAME
==
self
.
selected_catalogue
:
if
request
.
Restrictions
.
RestrictionList
.
CUBE_NAME
==
self
.
selected_catalogue
\
if
request
.
Properties
.
PropertyList
.
Catalog
is
not
None
:
and
request
.
Properties
.
PropertyList
.
Catalog
is
not
None
:
self
.
change_catalogue
(
request
.
Properties
.
PropertyList
.
Catalog
)
return
etree
.
fromstring
(
"""
self
.
change_catalogue
(
request
.
Properties
.
PropertyList
.
Catalog
)
<return>
return
etree
.
fromstring
(
"""
<root xmlns="urn:schemas-microsoft-com:xml-analysis:rowset"
<return>
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
<root xmlns="urn:schemas-microsoft-com:xml-analysis:rowset"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
"""
+
mdschema_sets_xsd
+
"""
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
</root>
"""
+
mdschema_sets_xsd
+
"""
</return>
</root>
"""
)
</return>
"""
)
def
discover_mdschema_kpis_response
(
self
,
request
):
def
discover_mdschema_kpis_response
(
self
,
request
):
if
request
.
Restrictions
.
RestrictionList
.
CUBE_NAME
==
self
.
selected_catalogue
:
if
request
.
Restrictions
.
RestrictionList
.
CUBE_NAME
==
self
.
selected_catalogue
\
if
request
.
Properties
.
PropertyList
.
Catalog
is
not
None
:
and
request
.
Properties
.
PropertyList
.
Catalog
is
not
None
:
self
.
change_catalogue
(
request
.
Properties
.
PropertyList
.
Catalog
)
return
etree
.
fromstring
(
"""
self
.
change_catalogue
(
request
.
Properties
.
PropertyList
.
Catalog
)
return
etree
.
fromstring
(
"""
<return>
<return>
<root xmlns="urn:schemas-microsoft-com:xml-analysis:rowset"
<root xmlns="urn:schemas-microsoft-com:xml-analysis:rowset"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
...
@@ -1693,12 +1696,12 @@ class XmlaDiscoverTools():
...
@@ -1693,12 +1696,12 @@ class XmlaDiscoverTools():
"""
.
format
(
_catalogues
))
"""
.
format
(
_catalogues
))
def
discover_mdschema_cubes_response
(
self
,
request
):
def
discover_mdschema_cubes_response
(
self
,
request
):
if
request
.
Restrictions
.
RestrictionList
.
CUBE_NAME
==
self
.
selected_catalogue
:
if
request
.
Restrictions
.
RestrictionList
.
CUBE_NAME
==
self
.
selected_catalogue
\
if
request
.
Properties
.
PropertyList
.
Catalog
is
not
None
:
and
request
.
Properties
.
PropertyList
.
Catalog
is
not
None
:
self
.
change_catalogue
(
request
.
Properties
.
PropertyList
.
Catalog
)
self
.
change_catalogue
(
request
.
Properties
.
PropertyList
.
Catalog
)
if
request
.
Restrictions
.
RestrictionList
.
CATALOG_NAME
==
self
.
selected_catalogue
:
if
request
.
Restrictions
.
RestrictionList
.
CATALOG_NAME
==
self
.
selected_catalogue
:
return
etree
.
fromstring
(
"""
return
etree
.
fromstring
(
"""
<return>
<return>
<root xmlns="urn:schemas-microsoft-com:xml-analysis:rowset"
<root xmlns="urn:schemas-microsoft-com:xml-analysis:rowset"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
...
@@ -1721,28 +1724,28 @@ class XmlaDiscoverTools():
...
@@ -1721,28 +1724,28 @@ class XmlaDiscoverTools():
</return>
</return>
"""
.
format
(
self
.
selected_catalogue
,
"""
.
format
(
self
.
selected_catalogue
,
self
.
selected_catalogue
))
self
.
selected_catalogue
))
return
etree
.
fromstring
(
"""
return
etree
.
fromstring
(
"""
<return>
<return>
<root xmlns="urn:schemas-microsoft-com:xml-analysis:rowset"
<root xmlns="urn:schemas-microsoft-com:xml-analysis:rowset"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
"""
+
mdschema_cubes_xsd
+
"""
"""
+
mdschema_cubes_xsd
+
"""
<row>
<row>
<CATALOG_NAME>{0}</CATALOG_NAME>
<CATALOG_NAME>{0}</CATALOG_NAME>
<CUBE_NAME>{0}</CUBE_NAME>
<CUBE_NAME>{0}</CUBE_NAME>
<CUBE_TYPE>CUBE</CUBE_TYPE>
<CUBE_TYPE>CUBE</CUBE_TYPE>
<LAST_SCHEMA_UPDATE>2016-07-25T15:18:20</LAST_SCHEMA_UPDATE>
<LAST_SCHEMA_UPDATE>2016-07-25T15:18:20</LAST_SCHEMA_UPDATE>
<LAST_DATA_UPDATE>2016-07-25T15:18:20</LAST_DATA_UPDATE>
<LAST_DATA_UPDATE>2016-07-25T15:18:20</LAST_DATA_UPDATE>
<DESCRIPTION>A demo. cube</DESCRIPTION>
<DESCRIPTION>A demo. cube</DESCRIPTION>
<IS_DRILLTHROUGH_ENABLED>true</IS_DRILLTHROUGH_ENABLED>
<IS_DRILLTHROUGH_ENABLED>true</IS_DRILLTHROUGH_ENABLED>
<IS_LINKABLE>false</IS_LINKABLE>
<IS_LINKABLE>false</IS_LINKABLE>
<IS_WRITE_ENABLED>false</IS_WRITE_ENABLED>
<IS_WRITE_ENABLED>false</IS_WRITE_ENABLED>
<IS_SQL_ENABLED>false</IS_SQL_ENABLED>
<IS_SQL_ENABLED>false</IS_SQL_ENABLED>
<CUBE_CAPTION>{0}</CUBE_CAPTION>
<CUBE_CAPTION>{0}</CUBE_CAPTION>
<CUBE_SOURCE>1</CUBE_SOURCE>
<CUBE_SOURCE>1</CUBE_SOURCE>
</row>
</row>
</root>
</root>
</return>"""
.
format
(
self
.
selected_catalogue
))
</return>"""
.
format
(
self
.
selected_catalogue
))
if
request
.
Properties
.
PropertyList
.
Catalog
is
not
None
:
if
request
.
Properties
.
PropertyList
.
Catalog
is
not
None
:
self
.
change_catalogue
(
request
.
Properties
.
PropertyList
.
Catalog
)
self
.
change_catalogue
(
request
.
Properties
.
PropertyList
.
Catalog
)
...
@@ -1785,94 +1788,93 @@ class XmlaDiscoverTools():
...
@@ -1785,94 +1788,93 @@ class XmlaDiscoverTools():
def
discover_mdschema_measures__response
(
self
,
request
):
def
discover_mdschema_measures__response
(
self
,
request
):
measures
=
""
measures
=
""
if
request
.
Restrictions
.
RestrictionList
.
CUBE_NAME
==
self
.
selected_catalogue
:
if
request
.
Restrictions
.
RestrictionList
.
CUBE_NAME
==
self
.
selected_catalogue
and
\
if
request
.
Restrictions
.
RestrictionList
.
MEASURE_VISIBILITY
==
3
:
request
.
Restrictions
.
RestrictionList
.
MEASURE_VISIBILITY
==
3
and
\
if
request
.
Properties
.
PropertyList
.
Catalog
is
not
None
:
request
.
Properties
.
PropertyList
.
Catalog
is
not
None
:
self
.
change_catalogue
(
request
.
Properties
.
PropertyList
.
Catalog
)
self
.
change_catalogue
(
request
.
Properties
.
PropertyList
.
Catalog
)
for
mes
in
self
.
executer
.
measures
:
for
mes
in
self
.
executer
.
measures
:
measures
+=
"""
measures
+=
"""
<row>
<row>
<CATALOG_NAME>{0}</CATALOG_NAME>
<CATALOG_NAME>{0}</CATALOG_NAME>
<CUBE_NAME>{1}</CUBE_NAME>
<CUBE_NAME>{1}</CUBE_NAME>
<MEASURE_NAME>{2}</MEASURE_NAME>
<MEASURE_NAME>{2}</MEASURE_NAME>
<MEASURE_UNIQUE_NAME>[Measures].[{2}]</MEASURE_UNIQUE_NAME>
<MEASURE_UNIQUE_NAME>[Measures].[{2}]</MEASURE_UNIQUE_NAME>
<MEASURE_CAPTION>{2}</MEASURE_CAPTION>
<MEASURE_CAPTION>{2}</MEASURE_CAPTION>
<MEASURE_AGGREGATOR>1</MEASURE_AGGREGATOR>
<MEASURE_AGGREGATOR>1</MEASURE_AGGREGATOR>
<DATA_TYPE>5</DATA_TYPE>
<DATA_TYPE>5</DATA_TYPE>
<NUMERIC_PRECISION>16</NUMERIC_PRECISION>
<NUMERIC_PRECISION>16</NUMERIC_PRECISION>
<NUMERIC_SCALE>-1</NUMERIC_SCALE>
<NUMERIC_SCALE>-1</NUMERIC_SCALE>
<MEASURE_IS_VISIBLE>true</MEASURE_IS_VISIBLE>
<MEASURE_IS_VISIBLE>true</MEASURE_IS_VISIBLE>
<MEASURE_NAME_SQL_COLUMN_NAME>{2}</MEASURE_NAME_SQL_COLUMN_NAME>
<MEASURE_NAME_SQL_COLUMN_NAME>{2}</MEASURE_NAME_SQL_COLUMN_NAME>
<MEASURE_UNQUALIFIED_CAPTION>{2}</MEASURE_UNQUALIFIED_CAPTION>
<MEASURE_UNQUALIFIED_CAPTION>{2}</MEASURE_UNQUALIFIED_CAPTION>
<MEASUREGROUP_NAME>default</MEASUREGROUP_NAME>
<MEASUREGROUP_NAME>default</MEASUREGROUP_NAME>
</row>
</row>
"""
.
format
(
self
.
selected_catalogue
,
"""
.
format
(
self
.
selected_catalogue
,
self
.
selected_catalogue
,
mes
)
self
.
selected_catalogue
,
mes
)
return
etree
.
fromstring
(
"""
<return>
return
etree
.
fromstring
(
"""
<root xmlns="urn:schemas-microsoft-com:xml-analysis:rowset"
<return>
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
<root xmlns="urn:schemas-microsoft-com:xml-analysis:rowset"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
"""
+
mdschema_measures_xsd
+
"""
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
{0}
"""
+
mdschema_measures_xsd
+
"""
</root>
{0}
</return>
</root>
"""
.
format
(
measures
))
</return>
"""
.
format
(
measures
))
def
discover_mdschema_dimensions_response
(
self
,
request
):
def
discover_mdschema_dimensions_response
(
self
,
request
):
if
request
.
Restrictions
.
RestrictionList
.
CUBE_NAME
==
self
.
selected_catalogue
:
if
request
.
Restrictions
.
RestrictionList
.
CUBE_NAME
==
self
.
selected_catalogue
and
\
if
request
.
Restrictions
.
RestrictionList
.
CATALOG_NAME
==
self
.
selected_catalogue
:
request
.
Restrictions
.
RestrictionList
.
CATALOG_NAME
==
self
.
selected_catalogue
and
\
if
request
.
Properties
.
PropertyList
.
Catalog
is
not
None
:
request
.
Properties
.
PropertyList
.
Catalog
is
not
None
:
self
.
change_catalogue
(
request
.
Properties
.
PropertyList
.
Catalog
)
rows
=
""
ord
=
1
for
tables
in
self
.
executer
.
get_all_tables_names
(
ignore_fact
=
True
):
# TODO in another idea, change this
# TO CHANGE NAME DISPLAY THAT EXISTS IN CONFIG FILE
if
MdxEngine
.
dimension_display_name
!=
[]:
if
tables
in
MdxEngine
.
dimension_display_name
:
continue
rows
+=
"""
<row>
<CATALOG_NAME>{0}</CATALOG_NAME>
<CUBE_NAME>{0}</CUBE_NAME>
<DIMENSION_NAME>{1}</DIMENSION_NAME>
<DIMENSION_UNIQUE_NAME>[{1}]</DIMENSION_UNIQUE_NAME>
<DIMENSION_CAPTION>{1}</DIMENSION_CAPTION>
<DIMENSION_ORDINAL>{2}</DIMENSION_ORDINAL>
<DIMENSION_TYPE>3</DIMENSION_TYPE>
<DIMENSION_CARDINALITY>23</DIMENSION_CARDINALITY>
<DEFAULT_HIERARCHY>[{1}].[{1}]</DEFAULT_HIERARCHY>
<IS_VIRTUAL>false</IS_VIRTUAL>
<IS_READWRITE>false</IS_READWRITE>
<DIMENSION_UNIQUE_SETTINGS>1</DIMENSION_UNIQUE_SETTINGS>
<DIMENSION_IS_VISIBLE>true</DIMENSION_IS_VISIBLE>
</row>"""
.
format
(
self
.
selected_catalogue
,
tables
,
ord
)
ord
+=
1
rows
+=
"""
self
.
change_catalogue
(
request
.
Properties
.
PropertyList
.
Catalog
)
<row>
rows
=
""
<CATALOG_NAME>{0}</CATALOG_NAME>
ord
=
1
<CUBE_NAME>{0}</CUBE_NAME>
<DIMENSION_NAME>Measures</DIMENSION_NAME>
for
tables
in
self
.
executer
.
get_all_tables_names
(
ignore_fact
=
True
):
<DIMENSION_UNIQUE_NAME>[Measures]</DIMENSION_UNIQUE_NAME>
<DIMENSION_CAPTION>Measures</DIMENSION_CAPTION>
# TODO in another idea, change this
<DIMENSION_ORDINAL>{1}</DIMENSION_ORDINAL>
# TO CHANGE NAME DISPLAY THAT EXISTS IN CONFIG FILE
<DIMENSION_TYPE>2</DIMENSION_TYPE>
if
MdxEngine
.
dimension_display_name
!=
[]
and
tables
in
MdxEngine
.
dimension_display_name
:
<DIMENSION_CARDINALITY>0</DIMENSION_CARDINALITY>
continue
<DEFAULT_HIERARCHY>[Measures]</DEFAULT_HIERARCHY>
rows
+=
"""
<IS_VIRTUAL>false</IS_VIRTUAL>
<row>
<IS_READWRITE>false</IS_READWRITE>
<CATALOG_NAME>{0}</CATALOG_NAME>
<DIMENSION_UNIQUE_SETTINGS>1</DIMENSION_UNIQUE_SETTINGS>
<CUBE_NAME>{0}</CUBE_NAME>
<DIMENSION_IS_VISIBLE>true</DIMENSION_IS_VISIBLE>
<DIMENSION_NAME>{1}</DIMENSION_NAME>
</row>"""
.
format
(
self
.
selected_catalogue
,
ord
)
<DIMENSION_UNIQUE_NAME>[{1}]</DIMENSION_UNIQUE_NAME>
<DIMENSION_CAPTION>{1}</DIMENSION_CAPTION>
<DIMENSION_ORDINAL>{2}</DIMENSION_ORDINAL>
<DIMENSION_TYPE>3</DIMENSION_TYPE>
<DIMENSION_CARDINALITY>23</DIMENSION_CARDINALITY>
<DEFAULT_HIERARCHY>[{1}].[{1}]</DEFAULT_HIERARCHY>
<IS_VIRTUAL>false</IS_VIRTUAL>
<IS_READWRITE>false</IS_READWRITE>
<DIMENSION_UNIQUE_SETTINGS>1</DIMENSION_UNIQUE_SETTINGS>
<DIMENSION_IS_VISIBLE>true</DIMENSION_IS_VISIBLE>
</row>"""
.
format
(
self
.
selected_catalogue
,
tables
,
ord
)
ord
+=
1
return
etree
.
fromstring
(
"""
rows
+=
"""
<row>
<CATALOG_NAME>{0}</CATALOG_NAME>
<CUBE_NAME>{0}</CUBE_NAME>
<DIMENSION_NAME>Measures</DIMENSION_NAME>
<DIMENSION_UNIQUE_NAME>[Measures]</DIMENSION_UNIQUE_NAME>
<DIMENSION_CAPTION>Measures</DIMENSION_CAPTION>
<DIMENSION_ORDINAL>{1}</DIMENSION_ORDINAL>
<DIMENSION_TYPE>2</DIMENSION_TYPE>
<DIMENSION_CARDINALITY>0</DIMENSION_CARDINALITY>
<DEFAULT_HIERARCHY>[Measures]</DEFAULT_HIERARCHY>
<IS_VIRTUAL>false</IS_VIRTUAL>
<IS_READWRITE>false</IS_READWRITE>
<DIMENSION_UNIQUE_SETTINGS>1</DIMENSION_UNIQUE_SETTINGS>
<DIMENSION_IS_VISIBLE>true</DIMENSION_IS_VISIBLE>
</row>"""
.
format
(
self
.
selected_catalogue
,
ord
)
return
etree
.
fromstring
(
"""
<return>
<return>
<root xmlns="urn:schemas-microsoft-com:xml-analysis:rowset" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<root xmlns="urn:schemas-microsoft-com:xml-analysis:rowset" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
"""
+
mdschema_dimensions_xsd
+
"""
"""
+
mdschema_dimensions_xsd
+
"""
...
@@ -1884,52 +1886,26 @@ class XmlaDiscoverTools():
...
@@ -1884,52 +1886,26 @@ class XmlaDiscoverTools():
def
discover_mdschema_hierarchies_response
(
self
,
request
):
def
discover_mdschema_hierarchies_response
(
self
,
request
):
# Enumeration of hierarchies in all dimensions
# Enumeration of hierarchies in all dimensions
if
request
.
Restrictions
.
RestrictionList
.
CUBE_NAME
==
self
.
selected_catalogue
:
if
request
.
Restrictions
.
RestrictionList
.
CUBE_NAME
==
self
.
selected_catalogue
and
\
if
request
.
Properties
.
PropertyList
.
Catalog
is
not
None
:
request
.
Properties
.
PropertyList
.
Catalog
is
not
None
:
self
.
change_catalogue
(
request
.
Properties
.
PropertyList
.
Catalog
)
if
request
.
Restrictions
.
RestrictionList
.
HIERARCHY_VISIBILITY
==
3
:
rows
=
""
for
table_name
,
df
in
self
.
executer
.
tables_loaded
.
items
():
# column = XmlaProvider.executer.get_columns_to_index(tables, 1, 0)[0]
if
table_name
==
self
.
executer
.
facts
:
continue
rows
+=
"""
<row>
<CATALOG_NAME>{0}</CATALOG_NAME>
<CUBE_NAME>{0}</CUBE_NAME>
<DIMENSION_UNIQUE_NAME>[{1}]</DIMENSION_UNIQUE_NAME>
<HIERARCHY_NAME>{1}</HIERARCHY_NAME>
<HIERARCHY_UNIQUE_NAME>[{1}].[{1}]</HIERARCHY_UNIQUE_NAME>
<HIERARCHY_CAPTION>{1}</HIERARCHY_CAPTION>
<DIMENSION_TYPE>3</DIMENSION_TYPE>
<HIERARCHY_CARDINALITY>6</HIERARCHY_CARDINALITY>
<DEFAULT_MEMBER>[{1}].[{1}].[{2}].[{3}]</DEFAULT_MEMBER>
<STRUCTURE>0</STRUCTURE>
<IS_VIRTUAL>false</IS_VIRTUAL>
<IS_READWRITE>false</IS_READWRITE>
<DIMENSION_UNIQUE_SETTINGS>1</DIMENSION_UNIQUE_SETTINGS>
<DIMENSION_IS_VISIBLE>true</DIMENSION_IS_VISIBLE>
<HIERARCHY_ORDINAL>1</HIERARCHY_ORDINAL>
<DIMENSION_IS_SHARED>true</DIMENSION_IS_SHARED>
<HIERARCHY_IS_VISIBLE>true</HIERARCHY_IS_VISIBLE>
<HIERARCHY_ORIGIN>1</HIERARCHY_ORIGIN>
<INSTANCE_SELECTION>0</INSTANCE_SELECTION>
</row>
"""
.
format
(
self
.
selected_catalogue
,
table_name
,
df
.
columns
[
0
],
df
.
iloc
[
0
][
0
])
# self.executer.get_attribute_column_rm_id(tables, column, 0))
self
.
change_catalogue
(
request
.
Properties
.
PropertyList
.
Catalog
)
if
request
.
Restrictions
.
RestrictionList
.
HIERARCHY_VISIBILITY
==
3
:
rows
=
""
for
table_name
,
df
in
self
.
executer
.
tables_loaded
.
items
():
if
table_name
==
self
.
executer
.
facts
:
continue
rows
+=
"""
rows
+=
"""
<row>
<row>
<CATALOG_NAME>{0}</CATALOG_NAME>
<CATALOG_NAME>{0}</CATALOG_NAME>
<CUBE_NAME>{0}</CUBE_NAME>
<CUBE_NAME>{0}</CUBE_NAME>
<DIMENSION_UNIQUE_NAME>[
Measures
]</DIMENSION_UNIQUE_NAME>
<DIMENSION_UNIQUE_NAME>[
{1}
]</DIMENSION_UNIQUE_NAME>
<HIERARCHY_NAME>
Measures
</HIERARCHY_NAME>
<HIERARCHY_NAME>
{1}
</HIERARCHY_NAME>
<HIERARCHY_UNIQUE_NAME>[
Measures
]</HIERARCHY_UNIQUE_NAME>
<HIERARCHY_UNIQUE_NAME>[
{1}].[{1}
]</HIERARCHY_UNIQUE_NAME>
<HIERARCHY_CAPTION>
Measures
</HIERARCHY_CAPTION>
<HIERARCHY_CAPTION>
{1}
</HIERARCHY_CAPTION>
<DIMENSION_TYPE>
2
</DIMENSION_TYPE>
<DIMENSION_TYPE>
3
</DIMENSION_TYPE>
<HIERARCHY_CARDINALITY>
0
</HIERARCHY_CARDINALITY>
<HIERARCHY_CARDINALITY>
6
</HIERARCHY_CARDINALITY>
<DEFAULT_MEMBER>[
Measures].[{1
}]</DEFAULT_MEMBER>
<DEFAULT_MEMBER>[
{1}].[{1}].[{2}].[{3
}]</DEFAULT_MEMBER>
<STRUCTURE>0</STRUCTURE>
<STRUCTURE>0</STRUCTURE>
<IS_VIRTUAL>false</IS_VIRTUAL>
<IS_VIRTUAL>false</IS_VIRTUAL>
<IS_READWRITE>false</IS_READWRITE>
<IS_READWRITE>false</IS_READWRITE>
...
@@ -1941,60 +1917,61 @@ class XmlaDiscoverTools():
...
@@ -1941,60 +1917,61 @@ class XmlaDiscoverTools():
<HIERARCHY_ORIGIN>1</HIERARCHY_ORIGIN>
<HIERARCHY_ORIGIN>1</HIERARCHY_ORIGIN>
<INSTANCE_SELECTION>0</INSTANCE_SELECTION>
<INSTANCE_SELECTION>0</INSTANCE_SELECTION>
</row>
</row>
"""
.
format
(
self
.
selected_catalogue
,
"""
.
format
(
self
.
selected_catalogue
,
table_name
,
self
.
executer
.
measures
[
0
])
df
.
columns
[
0
],
df
.
iloc
[
0
]
[
0
])
return
etree
.
fromstring
(
"""
rows
+=
"""
<return>
<row>
<root xmlns="urn:schemas-microsoft-com:xml-analysis:rowset"
<CATALOG_NAME>{0}</CATALOG_NAME>
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
<CUBE_NAME>{0}</CUBE_NAME>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<DIMENSION_UNIQUE_NAME>[Measures]</DIMENSION_UNIQUE_NAME>
"""
+
mdschema_hierarchies_xsd
+
"""
<HIERARCHY_NAME>Measures</HIERARCHY_NAME>
{0}
<HIERARCHY_UNIQUE_NAME>[Measures]</HIERARCHY_UNIQUE_NAME>
</root>
<HIERARCHY_CAPTION>Measures</HIERARCHY_CAPTION>
</return>
<DIMENSION_TYPE>2</DIMENSION_TYPE>
"""
.
format
(
rows
))
<HIERARCHY_CARDINALITY>0</HIERARCHY_CARDINALITY>
if
request
.
Restrictions
.
RestrictionList
.
CATALOG_NAME
==
self
.
selected_catalogue
:
<DEFAULT_MEMBER>[Measures].[{1}]</DEFAULT_MEMBER>
rows
=
""
<STRUCTURE>0</STRUCTURE>
for
table_name
,
df
in
self
.
executer
.
tables_loaded
.
items
():
<IS_VIRTUAL>false</IS_VIRTUAL>
if
table_name
==
self
.
executer
.
facts
:
<IS_READWRITE>false</IS_READWRITE>
continue
<DIMENSION_UNIQUE_SETTINGS>1</DIMENSION_UNIQUE_SETTINGS>
rows
+=
"""
<DIMENSION_IS_VISIBLE>true</DIMENSION_IS_VISIBLE>
<row>
<HIERARCHY_ORDINAL>1</HIERARCHY_ORDINAL>
<CATALOG_NAME>{0}</CATALOG_NAME>
<DIMENSION_IS_SHARED>true</DIMENSION_IS_SHARED>
<CUBE_NAME>{0}</CUBE_NAME>
<HIERARCHY_IS_VISIBLE>true</HIERARCHY_IS_VISIBLE>
<DIMENSION_UNIQUE_NAME>[{1}]</DIMENSION_UNIQUE_NAME>
<HIERARCHY_ORIGIN>1</HIERARCHY_ORIGIN>
<HIERARCHY_NAME>{1}</HIERARCHY_NAME>
<INSTANCE_SELECTION>0</INSTANCE_SELECTION>
<HIERARCHY_UNIQUE_NAME>[{1}].[{1}]</HIERARCHY_UNIQUE_NAME>
</row>
<HIERARCHY_CAPTION>{1}</HIERARCHY_CAPTION>
"""
.
format
(
self
.
selected_catalogue
,
<DIMENSION_TYPE>3</DIMENSION_TYPE>
self
.
executer
.
measures
[
0
])
<HIERARCHY_CARDINALITY>6</HIERARCHY_CARDINALITY>
<DEFAULT_MEMBER>[{1}].[{1}].[{2}].[{3}]</DEFAULT_MEMBER>
<STRUCTURE>0</STRUCTURE>
<IS_VIRTUAL>false</IS_VIRTUAL>
<IS_READWRITE>false</IS_READWRITE>
<DIMENSION_UNIQUE_SETTINGS>1</DIMENSION_UNIQUE_SETTINGS>
<DIMENSION_IS_VISIBLE>true</DIMENSION_IS_VISIBLE>
<HIERARCHY_ORDINAL>1</HIERARCHY_ORDINAL>
<DIMENSION_IS_SHARED>true</DIMENSION_IS_SHARED>
<HIERARCHY_IS_VISIBLE>true</HIERARCHY_IS_VISIBLE>
<HIERARCHY_ORIGIN>1</HIERARCHY_ORIGIN>
<INSTANCE_SELECTION>0</INSTANCE_SELECTION>
</row>
"""
.
format
(
self
.
selected_catalogue
,
table_name
,
df
.
columns
[
0
],
df
.
iloc
[
0
][
0
])
return
etree
.
fromstring
(
"""
<return>
<root xmlns="urn:schemas-microsoft-com:xml-analysis:rowset"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
"""
+
mdschema_hierarchies_xsd
+
"""
{0}
</root>
</return>
"""
.
format
(
rows
))
if
request
.
Restrictions
.
RestrictionList
.
CATALOG_NAME
==
self
.
selected_catalogue
:
rows
=
""
for
table_name
,
df
in
self
.
executer
.
tables_loaded
.
items
():
if
table_name
==
self
.
executer
.
facts
:
continue
rows
+=
"""
rows
+=
"""
<row>
<row>
<CATALOG_NAME>{0}</CATALOG_NAME>
<CATALOG_NAME>{0}</CATALOG_NAME>
<CUBE_NAME>{0}</CUBE_NAME>
<CUBE_NAME>{0}</CUBE_NAME>
<DIMENSION_UNIQUE_NAME>[
Measures
]</DIMENSION_UNIQUE_NAME>
<DIMENSION_UNIQUE_NAME>[
{1}
]</DIMENSION_UNIQUE_NAME>
<HIERARCHY_NAME>
Measures
</HIERARCHY_NAME>
<HIERARCHY_NAME>
{1}
</HIERARCHY_NAME>
<HIERARCHY_UNIQUE_NAME>[
Measures
]</HIERARCHY_UNIQUE_NAME>
<HIERARCHY_UNIQUE_NAME>[
{1}].[{1}
]</HIERARCHY_UNIQUE_NAME>
<HIERARCHY_CAPTION>
Measures
</HIERARCHY_CAPTION>
<HIERARCHY_CAPTION>
{1}
</HIERARCHY_CAPTION>
<DIMENSION_TYPE>
2
</DIMENSION_TYPE>
<DIMENSION_TYPE>
3
</DIMENSION_TYPE>
<HIERARCHY_CARDINALITY>
0
</HIERARCHY_CARDINALITY>
<HIERARCHY_CARDINALITY>
6
</HIERARCHY_CARDINALITY>
<DEFAULT_MEMBER>[
Measures].[{1
}]</DEFAULT_MEMBER>
<DEFAULT_MEMBER>[
{1}].[{1}].[{2}].[{3
}]</DEFAULT_MEMBER>
<STRUCTURE>0</STRUCTURE>
<STRUCTURE>0</STRUCTURE>
<IS_VIRTUAL>false</IS_VIRTUAL>
<IS_VIRTUAL>false</IS_VIRTUAL>
<IS_READWRITE>false</IS_READWRITE>
<IS_READWRITE>false</IS_READWRITE>
...
@@ -2005,64 +1982,66 @@ class XmlaDiscoverTools():
...
@@ -2005,64 +1982,66 @@ class XmlaDiscoverTools():
<HIERARCHY_IS_VISIBLE>true</HIERARCHY_IS_VISIBLE>
<HIERARCHY_IS_VISIBLE>true</HIERARCHY_IS_VISIBLE>
<HIERARCHY_ORIGIN>1</HIERARCHY_ORIGIN>
<HIERARCHY_ORIGIN>1</HIERARCHY_ORIGIN>
<INSTANCE_SELECTION>0</INSTANCE_SELECTION>
<INSTANCE_SELECTION>0</INSTANCE_SELECTION>
</row>"""
.
format
(
self
.
selected_catalogue
,
</row>
"""
.
format
(
self
.
selected_catalogue
,
table_name
,
df
.
columns
[
0
],
df
.
iloc
[
0
][
0
])
rows
+=
"""
<row>
<CATALOG_NAME>{0}</CATALOG_NAME>
<CUBE_NAME>{0}</CUBE_NAME>
<DIMENSION_UNIQUE_NAME>[Measures]</DIMENSION_UNIQUE_NAME>
<HIERARCHY_NAME>Measures</HIERARCHY_NAME>
<HIERARCHY_UNIQUE_NAME>[Measures]</HIERARCHY_UNIQUE_NAME>
<HIERARCHY_CAPTION>Measures</HIERARCHY_CAPTION>
<DIMENSION_TYPE>2</DIMENSION_TYPE>
<HIERARCHY_CARDINALITY>0</HIERARCHY_CARDINALITY>
<DEFAULT_MEMBER>[Measures].[{1}]</DEFAULT_MEMBER>
<STRUCTURE>0</STRUCTURE>
<IS_VIRTUAL>false</IS_VIRTUAL>
<IS_READWRITE>false</IS_READWRITE>
<DIMENSION_UNIQUE_SETTINGS>1</DIMENSION_UNIQUE_SETTINGS>
<DIMENSION_IS_VISIBLE>true</DIMENSION_IS_VISIBLE>
<HIERARCHY_ORDINAL>1</HIERARCHY_ORDINAL>
<DIMENSION_IS_SHARED>true</DIMENSION_IS_SHARED>
<HIERARCHY_IS_VISIBLE>true</HIERARCHY_IS_VISIBLE>
<HIERARCHY_ORIGIN>1</HIERARCHY_ORIGIN>
<INSTANCE_SELECTION>0</INSTANCE_SELECTION>
</row>"""
.
format
(
self
.
selected_catalogue
,
self
.
executer
.
measures
[
0
])
self
.
executer
.
measures
[
0
])
return
etree
.
fromstring
(
"""
return
etree
.
fromstring
(
"""
<return>
<return>
<root xmlns="urn:schemas-microsoft-com:xml-analysis:rowset"
<root xmlns="urn:schemas-microsoft-com:xml-analysis:rowset"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
"""
+
mdschema_hierarchies_xsd
+
"""
"""
+
mdschema_hierarchies_xsd
+
"""
{0}
{0}
</root>
</root>
</return>"""
.
format
(
rows
))
</return>"""
.
format
(
rows
))
def
discover_mdschema_levels__response
(
self
,
request
):
def
discover_mdschema_levels__response
(
self
,
request
):
# TODO fix levels in the same table (with xml file maybe) !!!!!!!!!
# TODO fix levels in the same table (with xml file maybe) !!!!!!!!!
if
request
.
Restrictions
.
RestrictionList
.
CUBE_NAME
==
self
.
selected_catalogue
:
if
request
.
Restrictions
.
RestrictionList
.
CUBE_NAME
==
self
.
selected_catalogue
and
\
if
request
.
Restrictions
.
RestrictionList
.
CATALOG_NAME
==
self
.
selected_catalogue
:
request
.
Restrictions
.
RestrictionList
.
CATALOG_NAME
==
self
.
selected_catalogue
and
\
if
request
.
Properties
.
PropertyList
.
Catalog
is
not
None
:
request
.
Properties
.
PropertyList
.
Catalog
is
not
None
:
self
.
change_catalogue
(
request
.
Properties
.
PropertyList
.
Catalog
)
rows
=
""
for
tables
in
self
.
executer
.
get_all_tables_names
(
ignore_fact
=
True
):
l_nb
=
0
for
col
in
self
.
executer
.
tables_loaded
[
tables
].
columns
:
rows
+=
"""
<row>
<CATALOG_NAME>{0}</CATALOG_NAME>
<CUBE_NAME>{0}</CUBE_NAME>
<DIMENSION_UNIQUE_NAME>[{1}]</DIMENSION_UNIQUE_NAME>
<HIERARCHY_UNIQUE_NAME>[{1}].[{1}]</HIERARCHY_UNIQUE_NAME>
<LEVEL_NAME>{2}</LEVEL_NAME>
<LEVEL_UNIQUE_NAME>[{1}].[{1}].[{2}]</LEVEL_UNIQUE_NAME>
<LEVEL_CAPTION>{2}</LEVEL_CAPTION>
<LEVEL_NUMBER>{3}</LEVEL_NUMBER>
<LEVEL_CARDINALITY>1</LEVEL_CARDINALITY>
<LEVEL_TYPE>0</LEVEL_TYPE>
<CUSTOM_ROLLUP_SETTINGS>0</CUSTOM_ROLLUP_SETTINGS>
<LEVEL_UNIQUE_SETTINGS>0</LEVEL_UNIQUE_SETTINGS>
<LEVEL_IS_VISIBLE>true</LEVEL_IS_VISIBLE>
<LEVEL_DBTYPE>130</LEVEL_DBTYPE>
<LEVEL_KEY_CARDINALITY>1</LEVEL_KEY_CARDINALITY>
<LEVEL_ORIGIN>2</LEVEL_ORIGIN>
</row>
"""
.
format
(
self
.
selected_catalogue
,
tables
,
col
,
l_nb
)
l_nb
+=
1
self
.
change_catalogue
(
request
.
Properties
.
PropertyList
.
Catalog
)
rows
=
""
for
tables
in
self
.
executer
.
get_all_tables_names
(
ignore_fact
=
True
):
l_nb
=
0
for
col
in
self
.
executer
.
tables_loaded
[
tables
].
columns
:
rows
+=
"""
rows
+=
"""
<row>
<row>
<CATALOG_NAME>{0}</CATALOG_NAME>
<CATALOG_NAME>{0}</CATALOG_NAME>
<CUBE_NAME>{0}</CUBE_NAME>
<CUBE_NAME>{0}</CUBE_NAME>
<DIMENSION_UNIQUE_NAME>[
Measures
]</DIMENSION_UNIQUE_NAME>
<DIMENSION_UNIQUE_NAME>[
{1}
]</DIMENSION_UNIQUE_NAME>
<HIERARCHY_UNIQUE_NAME>[
Measures
]</HIERARCHY_UNIQUE_NAME>
<HIERARCHY_UNIQUE_NAME>[
{1}].[{1}
]</HIERARCHY_UNIQUE_NAME>
<LEVEL_NAME>
MeasuresLevel
</LEVEL_NAME>
<LEVEL_NAME>
{2}
</LEVEL_NAME>
<LEVEL_UNIQUE_NAME>[
Measures
]</LEVEL_UNIQUE_NAME>
<LEVEL_UNIQUE_NAME>[
{1}].[{1}].[{2}
]</LEVEL_UNIQUE_NAME>
<LEVEL_CAPTION>
MeasuresLevel
</LEVEL_CAPTION>
<LEVEL_CAPTION>
{2}
</LEVEL_CAPTION>
<LEVEL_NUMBER>
0
</LEVEL_NUMBER>
<LEVEL_NUMBER>
{3}
</LEVEL_NUMBER>
<LEVEL_CARDINALITY>
0
</LEVEL_CARDINALITY>
<LEVEL_CARDINALITY>
1
</LEVEL_CARDINALITY>
<LEVEL_TYPE>0</LEVEL_TYPE>
<LEVEL_TYPE>0</LEVEL_TYPE>
<CUSTOM_ROLLUP_SETTINGS>0</CUSTOM_ROLLUP_SETTINGS>
<CUSTOM_ROLLUP_SETTINGS>0</CUSTOM_ROLLUP_SETTINGS>
<LEVEL_UNIQUE_SETTINGS>0</LEVEL_UNIQUE_SETTINGS>
<LEVEL_UNIQUE_SETTINGS>0</LEVEL_UNIQUE_SETTINGS>
...
@@ -2071,82 +2050,109 @@ class XmlaDiscoverTools():
...
@@ -2071,82 +2050,109 @@ class XmlaDiscoverTools():
<LEVEL_KEY_CARDINALITY>1</LEVEL_KEY_CARDINALITY>
<LEVEL_KEY_CARDINALITY>1</LEVEL_KEY_CARDINALITY>
<LEVEL_ORIGIN>2</LEVEL_ORIGIN>
<LEVEL_ORIGIN>2</LEVEL_ORIGIN>
</row>
</row>
"""
.
format
(
self
.
selected_catalogue
)
"""
.
format
(
self
.
selected_catalogue
,
tables
,
col
,
l_nb
)
l_nb
+=
1
return
etree
.
fromstring
(
"""
rows
+=
"""
<return>
<row>
<root xmlns="urn:schemas-microsoft-com:xml-analysis:rowset"
<CATALOG_NAME>{0}</CATALOG_NAME>
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
<CUBE_NAME>{0}</CUBE_NAME>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<DIMENSION_UNIQUE_NAME>[Measures]</DIMENSION_UNIQUE_NAME>
"""
+
mdschema_levels_xsd
+
"""
<HIERARCHY_UNIQUE_NAME>[Measures]</HIERARCHY_UNIQUE_NAME>
{0}
<LEVEL_NAME>MeasuresLevel</LEVEL_NAME>
</root>
<LEVEL_UNIQUE_NAME>[Measures]</LEVEL_UNIQUE_NAME>
</return>"""
.
format
(
rows
))
<LEVEL_CAPTION>MeasuresLevel</LEVEL_CAPTION>
<LEVEL_NUMBER>0</LEVEL_NUMBER>
<LEVEL_CARDINALITY>0</LEVEL_CARDINALITY>
<LEVEL_TYPE>0</LEVEL_TYPE>
<CUSTOM_ROLLUP_SETTINGS>0</CUSTOM_ROLLUP_SETTINGS>
<LEVEL_UNIQUE_SETTINGS>0</LEVEL_UNIQUE_SETTINGS>
<LEVEL_IS_VISIBLE>true</LEVEL_IS_VISIBLE>
<LEVEL_DBTYPE>130</LEVEL_DBTYPE>
<LEVEL_KEY_CARDINALITY>1</LEVEL_KEY_CARDINALITY>
<LEVEL_ORIGIN>2</LEVEL_ORIGIN>
</row>
"""
.
format
(
self
.
selected_catalogue
)
return
etree
.
fromstring
(
"""
<return>
<root xmlns="urn:schemas-microsoft-com:xml-analysis:rowset"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
"""
+
mdschema_levels_xsd
+
"""
{0}
</root>
</return>"""
.
format
(
rows
))
def
discover_mdschema_measuresgroups_response
(
self
,
request
):
def
discover_mdschema_measuresgroups_response
(
self
,
request
):
if
request
.
Restrictions
.
RestrictionList
.
CUBE_NAME
==
self
.
selected_catalogue
:
if
request
.
Restrictions
.
RestrictionList
.
CUBE_NAME
==
self
.
selected_catalogue
and
\
if
request
.
Properties
.
PropertyList
.
Catalog
is
not
None
:
request
.
Properties
.
PropertyList
.
Catalog
is
not
None
:
self
.
change_catalogue
(
request
.
Properties
.
PropertyList
.
Catalog
)
return
etree
.
fromstring
(
"""
<return>
<root xmlns="urn:schemas-microsoft-com:xml-analysis:rowset"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
"""
+
mdschema_measuresgroups_xsd
+
"""
<row>
<CATALOG_NAME>{0}</CATALOG_NAME>
<CUBE_NAME>{0}</CUBE_NAME>
<MEASUREGROUP_NAME>default</MEASUREGROUP_NAME>
<DESCRIPTION>-</DESCRIPTION>
<IS_WRITE_ENABLED>true</IS_WRITE_ENABLED>
<MEASUREGROUP_CAPTION>default</MEASUREGROUP_CAPTION>
</row>
</root>
</return>
"""
.
format
(
self
.
selected_catalogue
))
def
discover_mdschema_measuresgroups_dimensions_response
(
self
,
request
):
self
.
change_catalogue
(
request
.
Properties
.
PropertyList
.
Catalog
)
if
request
.
Restrictions
.
RestrictionList
.
CUBE_NAME
==
self
.
selected_catalogue
:
return
etree
.
fromstring
(
"""
if
request
.
Properties
.
PropertyList
.
Catalog
is
not
None
:
<return>
self
.
change_catalogue
(
request
.
Properties
.
PropertyList
.
Catalog
)
<root xmlns="urn:schemas-microsoft-com:xml-analysis:rowset"
rows
=
""
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
for
tables
in
self
.
executer
.
get_all_tables_names
(
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
ignore_fact
=
True
):
"""
+
mdschema_measuresgroups_xsd
+
"""
rows
+=
"""
<row>
<row>
<CATALOG_NAME>{0}</CATALOG_NAME>
<CATALOG_NAME>{0}</CATALOG_NAME>
<CUBE_NAME>{0}</CUBE_NAME>
<CUBE_NAME>{0}</CUBE_NAME>
<MEASUREGROUP_NAME>default</MEASUREGROUP_NAME>
<MEASUREGROUP_NAME>default</MEASUREGROUP_NAME>
<MEASUREGROUP_CARDINALITY>ONE</MEASUREGROUP_CARDINALITY>
<DESCRIPTION>-</DESCRIPTION>
<DIMENSION_UNIQUE_NAME>[{1}]</DIMENSION_UNIQUE_NAME>
<IS_WRITE_ENABLED>true</IS_WRITE_ENABLED>
<DIMENSION_CARDINALITY>MANY</DIMENSION_CARDINALITY>
<MEASUREGROUP_CAPTION>default</MEASUREGROUP_CAPTION>
<DIMENSION_IS_VISIBLE>true</DIMENSION_IS_VISIBLE>
<DIMENSION_IS_FACT_DIMENSION>false</DIMENSION_IS_FACT_DIMENSION>
<DIMENSION_GRANULARITY>[{1}].[{1}]</DIMENSION_GRANULARITY>
</row>
</row>
"""
.
format
(
self
.
selected_catalogue
,
tables
)
</root>
</return>
"""
.
format
(
self
.
selected_catalogue
))
return
etree
.
fromstring
(
"""
def
discover_mdschema_measuresgroups_dimensions_response
(
self
,
request
):
<return>
if
request
.
Restrictions
.
RestrictionList
.
CUBE_NAME
==
self
.
selected_catalogue
and
\
request
.
Properties
.
PropertyList
.
Catalog
is
not
None
:
self
.
change_catalogue
(
request
.
Properties
.
PropertyList
.
Catalog
)
rows
=
""
for
tables
in
self
.
executer
.
get_all_tables_names
(
ignore_fact
=
True
):
rows
+=
"""
<row>
<CATALOG_NAME>{0}</CATALOG_NAME>
<CUBE_NAME>{0}</CUBE_NAME>
<MEASUREGROUP_NAME>default</MEASUREGROUP_NAME>
<MEASUREGROUP_CARDINALITY>ONE</MEASUREGROUP_CARDINALITY>
<DIMENSION_UNIQUE_NAME>[{1}]</DIMENSION_UNIQUE_NAME>
<DIMENSION_CARDINALITY>MANY</DIMENSION_CARDINALITY>
<DIMENSION_IS_VISIBLE>true</DIMENSION_IS_VISIBLE>
<DIMENSION_IS_FACT_DIMENSION>false</DIMENSION_IS_FACT_DIMENSION>
<DIMENSION_GRANULARITY>[{1}].[{1}]</DIMENSION_GRANULARITY>
</row>
"""
.
format
(
self
.
selected_catalogue
,
tables
)
return
etree
.
fromstring
(
"""
<return>
<root xmlns="urn:schemas-microsoft-com:xml-analysis:rowset"
<root xmlns="urn:schemas-microsoft-com:xml-analysis:rowset"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
"""
+
mdschema_measuresgroups_dimensions_xsd
+
"""
"""
+
mdschema_measuresgroups_dimensions_xsd
+
"""
{0}
{0}
</root>
</root>
</return>
</return>
"""
.
format
(
rows
))
"""
.
format
(
rows
))
def
discover_mdschema_properties_response
(
self
,
request
):
def
discover_mdschema_properties_response
(
self
,
request
):
if
request
.
Restrictions
.
RestrictionList
.
PROPERTY_TYPE
==
2
:
if
request
.
Properties
.
PropertyList
.
Catalog
is
not
None
:
if
request
.
Restrictions
.
RestrictionList
.
PROPERTY_TYPE
==
2
and
\
self
.
change_catalogue
(
request
.
Properties
.
PropertyList
.
Catalog
)
request
.
Properties
.
PropertyList
.
Catalog
is
not
None
:
return
etree
.
fromstring
(
"""
<return>
self
.
change_catalogue
(
request
.
Properties
.
PropertyList
.
Catalog
)
<root xmlns="urn:schemas-microsoft-com:xml-analysis:rowset"
return
etree
.
fromstring
(
"""
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
<return>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<root xmlns="urn:schemas-microsoft-com:xml-analysis:rowset"
{1}
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
{1}
<row>
<row>
<CATALOG_NAME>{0}</CATALOG_NAME>
<CATALOG_NAME>{0}</CATALOG_NAME>
<PROPERTY_TYPE>2</PROPERTY_TYPE>
<PROPERTY_TYPE>2</PROPERTY_TYPE>
...
@@ -2247,8 +2253,9 @@ class XmlaDiscoverTools():
...
@@ -2247,8 +2253,9 @@ class XmlaDiscoverTools():
</row>
</row>
</root>
</root>
</return>
</return>
"""
.
format
(
self
.
selected_catalogue
,
"""
.
format
(
self
.
selected_catalogue
,
mdschema_properties_properties_xsd
))
mdschema_properties_properties_xsd
))
elif
request
.
Restrictions
.
RestrictionList
.
PROPERTY_TYPE
==
1
:
elif
request
.
Restrictions
.
RestrictionList
.
PROPERTY_TYPE
==
1
:
return
etree
.
fromstring
(
"""
return
etree
.
fromstring
(
"""
<return>
<return>
...
@@ -2262,48 +2269,48 @@ class XmlaDiscoverTools():
...
@@ -2262,48 +2269,48 @@ class XmlaDiscoverTools():
def
discover_mdschema_members_response
(
self
,
request
):
def
discover_mdschema_members_response
(
self
,
request
):
# Enumeration of hierarchies in all dimensions
# Enumeration of hierarchies in all dimensions
if
request
.
Restrictions
.
RestrictionList
.
CUBE_NAME
==
self
.
selected_catalogue
:
if
request
.
Restrictions
.
RestrictionList
.
CUBE_NAME
==
self
.
selected_catalogue
and
\
if
request
.
Properties
.
PropertyList
.
Catalog
is
not
None
:
request
.
Properties
.
PropertyList
.
Catalog
is
not
None
and
\
self
.
change_catalogue
(
request
.
Properties
.
PropertyList
.
Catalog
)
request
.
Restrictions
.
RestrictionList
.
TREE_OP
==
8
:
if
request
.
Restrictions
.
RestrictionList
.
TREE_OP
==
8
:
separed_tuple
=
request
.
Restrictions
.
RestrictionList
.
MEMBER_UNIQUE_NAME
.
split
(
self
.
change_catalogue
(
request
.
Properties
.
PropertyList
.
Catalog
)
"."
)
separed_tuple
=
request
.
Restrictions
.
RestrictionList
.
MEMBER_UNIQUE_NAME
.
split
(
joined
=
"."
.
join
(
separed_tuple
[:
-
1
]
)
"."
)
# exple
joined
=
"."
.
join
(
separed_tuple
[:
-
1
])
# separed_tuple -> [Product].[Product].[Company].[Crazy Development]
# exple
# joined -> [Product].[Product].[Company
]
# separed_tuple -> [Product].[Product].[Company].[Crazy Development
]
# joined -> [Product].[Product].[Company]
last_attribut
=
''
.
join
(
att
for
att
in
separed_tuple
[
-
1
]
if
att
not
in
'[]'
).
replace
(
'&'
,
last_attribut
=
''
.
join
(
att
for
att
in
separed_tuple
[
-
1
]
'&'
)
if
att
not
in
'[]'
).
replace
(
'&'
,
return
etree
.
fromstring
(
"""
'&'
)
<return>
return
etree
.
fromstring
(
"""
<root xmlns="urn:schemas-microsoft-com:xml-analysis:rowset"
<return>
xmlns:xsd="http://www.w3.org/2001/XMLSchema
"
<root xmlns="urn:schemas-microsoft-com:xml-analysis:rowset
"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
"""
+
mdschema_members_xsd
+
"""
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<row>
"""
+
mdschema_members_xsd
+
"""
<CATALOG_NAME>{0}</CATALOG_NAME
>
<row
>
<CUBE_NAME>{0}</CUBE
_NAME>
<CATALOG_NAME>{0}</CATALOG
_NAME>
<DIMENSION_UNIQUE_NAME>{1}</DIMENSION_UNIQU
E_NAME>
<CUBE_NAME>{0}</CUB
E_NAME>
<HIERARCHY_UNIQUE_NAME>{1}.{1}</HIERARCHY
_UNIQUE_NAME>
<DIMENSION_UNIQUE_NAME>{1}</DIMENSION
_UNIQUE_NAME>
<LEVEL_UNIQUE_NAME>{2}</LEVEL
_UNIQUE_NAME>
<HIERARCHY_UNIQUE_NAME>{1}.{1}</HIERARCHY
_UNIQUE_NAME>
<LEVEL_NUMBER>0</LEVEL_NUMBER
>
<LEVEL_UNIQUE_NAME>{2}</LEVEL_UNIQUE_NAME
>
<MEMBER_ORDINAL>0</MEMBER_ORDINAL
>
<LEVEL_NUMBER>0</LEVEL_NUMBER
>
<MEMBER_NAME>"""
+
last_attribut
+
"""</MEMBER_NAME
>
<MEMBER_ORDINAL>0</MEMBER_ORDINAL
>
<MEMBER_UNIQUE_NAME>{3}</MEMBER_UNIQUE
_NAME>
<MEMBER_NAME>"""
+
last_attribut
+
"""</MEMBER
_NAME>
<MEMBER_TYPE>1</MEMBER_TYP
E>
<MEMBER_UNIQUE_NAME>{3}</MEMBER_UNIQUE_NAM
E>
<MEMBER_CAPTION>"""
+
last_attribut
+
<MEMBER_TYPE>1</MEMBER_TYPE>
"""</MEMBER_CAPTION>
<MEMBER_CAPTION>"""
+
last_attribut
+
"""</MEMBER_CAPTION>
<CHILDREN_CARDINALITY>1</CHILDREN_CARDINALITY>
<CHILDREN_CARDINALITY>1</CHILDREN_CARDINALITY>
<PARENT_LEVEL>0</PARENT_LEVEL>
<PARENT_LEVEL>0</PARENT_LEVEL>
<PARENT_COUNT>0</PARENT_COUNT>
<PARENT_COUNT>0</PARENT_COUNT>
<MEMBER_KEY>"""
+
last_attribut
+
"""</MEMBER_KEY>
<MEMBER_KEY>"""
+
last_attribut
+
"""</MEMBER_KEY>
<IS_PLACEHOLDERMEMBER>false</IS_PLACEHOLDERMEMBER>
<IS_PLACEHOLDERMEMBER>false</IS_PLACEHOLDERMEMBER>
<IS_DATAMEMBER>false</IS_DATAMEMBER>
<IS_DATAMEMBER>false</IS_DATAMEMBER>
</row>
</row>
</root>
</root>
</return>
</return>
"""
.
format
(
self
.
selected_catalogue
,
separed_tuple
[
"""
.
format
(
self
.
selected_catalogue
,
separed_tuple
[
0
],
joined
,
request
.
0
],
joined
,
request
.
Restrictions
.
RestrictionList
.
MEMBER_UNIQUE_NAME
))
Restrictions
.
RestrictionList
.
MEMBER_UNIQUE_NAME
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment