Commit 81b1c0f5 authored by mouadh's avatar mouadh

unsed response

parent ad31383a
...@@ -964,7 +964,8 @@ class XmlaDiscoverTools(): ...@@ -964,7 +964,8 @@ class XmlaDiscoverTools():
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)
if request.Restrictions.RestrictionList.HIERARCHY_VISIBILITY == 3: if request.Restrictions.RestrictionList.HIERARCHY_VISIBILITY == 3 or \
request.Restrictions.RestrictionList.CATALOG_NAME == self.selected_catalogue:
rows = "" rows = ""
for table_name, df in self.executer.tables_loaded.items(): for table_name, df in self.executer.tables_loaded.items():
if table_name == self.executer.facts: if table_name == self.executer.facts:
...@@ -1038,77 +1039,77 @@ class XmlaDiscoverTools(): ...@@ -1038,77 +1039,77 @@ class XmlaDiscoverTools():
</return> </return>
""".format(rows)) """.format(rows))
if request.Restrictions.RestrictionList.CATALOG_NAME == self.selected_catalogue: # if request.Restrictions.RestrictionList.CATALOG_NAME == self.selected_catalogue:
rows = "" # rows = ""
for table_name, df in self.executer.tables_loaded.items(): # for table_name, df in self.executer.tables_loaded.items():
if table_name == self.executer.facts: # if table_name == self.executer.facts:
continue # continue
#
# french caracteres # # french caracteres
# TODO encode dataframe # # TODO encode dataframe
if type(df.iloc[0][0]) == unicode: # if type(df.iloc[0][0]) == unicode:
column_attribut = df.iloc[0][0].encode('utf-8', # column_attribut = df.iloc[0][0].encode('utf-8',
'replace') # 'replace')
else: # else:
column_attribut = df.iloc[0][0] # column_attribut = df.iloc[0][0]
#
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>[{1}]</DIMENSION_UNIQUE_NAME> # <DIMENSION_UNIQUE_NAME>[{1}]</DIMENSION_UNIQUE_NAME>
<HIERARCHY_NAME>{1}</HIERARCHY_NAME> # <HIERARCHY_NAME>{1}</HIERARCHY_NAME>
<HIERARCHY_UNIQUE_NAME>[{1}].[{1}]</HIERARCHY_UNIQUE_NAME> # <HIERARCHY_UNIQUE_NAME>[{1}].[{1}]</HIERARCHY_UNIQUE_NAME>
<HIERARCHY_CAPTION>{1}</HIERARCHY_CAPTION> # <HIERARCHY_CAPTION>{1}</HIERARCHY_CAPTION>
<DIMENSION_TYPE>3</DIMENSION_TYPE> # <DIMENSION_TYPE>3</DIMENSION_TYPE>
<HIERARCHY_CARDINALITY>6</HIERARCHY_CARDINALITY> # <HIERARCHY_CARDINALITY>6</HIERARCHY_CARDINALITY>
<DEFAULT_MEMBER>[{1}].[{1}].[{2}].[{3}]</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>
<DIMENSION_UNIQUE_SETTINGS>1</DIMENSION_UNIQUE_SETTINGS> # <DIMENSION_UNIQUE_SETTINGS>1</DIMENSION_UNIQUE_SETTINGS>
<DIMENSION_IS_VISIBLE>true</DIMENSION_IS_VISIBLE> # <DIMENSION_IS_VISIBLE>true</DIMENSION_IS_VISIBLE>
<HIERARCHY_ORDINAL>1</HIERARCHY_ORDINAL> # <HIERARCHY_ORDINAL>1</HIERARCHY_ORDINAL>
<DIMENSION_IS_SHARED>true</DIMENSION_IS_SHARED> # <DIMENSION_IS_SHARED>true</DIMENSION_IS_SHARED>
<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> # </row>
""".format(self.selected_catalogue, table_name, # """.format(self.selected_catalogue, table_name,
df.columns[0], column_attribut) # df.columns[0], column_attribut)
#
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>[Measures]</DIMENSION_UNIQUE_NAME>
<HIERARCHY_NAME>Measures</HIERARCHY_NAME> # <HIERARCHY_NAME>Measures</HIERARCHY_NAME>
<HIERARCHY_UNIQUE_NAME>[Measures]</HIERARCHY_UNIQUE_NAME> # <HIERARCHY_UNIQUE_NAME>[Measures]</HIERARCHY_UNIQUE_NAME>
<HIERARCHY_CAPTION>Measures</HIERARCHY_CAPTION> # <HIERARCHY_CAPTION>Measures</HIERARCHY_CAPTION>
<DIMENSION_TYPE>2</DIMENSION_TYPE> # <DIMENSION_TYPE>2</DIMENSION_TYPE>
<HIERARCHY_CARDINALITY>0</HIERARCHY_CARDINALITY> # <HIERARCHY_CARDINALITY>0</HIERARCHY_CARDINALITY>
<DEFAULT_MEMBER>[Measures].[{1}]</DEFAULT_MEMBER> # <DEFAULT_MEMBER>[Measures].[{1}]</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>
<DIMENSION_UNIQUE_SETTINGS>1</DIMENSION_UNIQUE_SETTINGS> # <DIMENSION_UNIQUE_SETTINGS>1</DIMENSION_UNIQUE_SETTINGS>
<DIMENSION_IS_VISIBLE>true</DIMENSION_IS_VISIBLE> # <DIMENSION_IS_VISIBLE>true</DIMENSION_IS_VISIBLE>
<HIERARCHY_ORDINAL>1</HIERARCHY_ORDINAL> # <HIERARCHY_ORDINAL>1</HIERARCHY_ORDINAL>
<DIMENSION_IS_SHARED>true</DIMENSION_IS_SHARED> # <DIMENSION_IS_SHARED>true</DIMENSION_IS_SHARED>
<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,
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) !!!!!!!!!
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment