Commit 81e47334 authored by Jérome Perrin's avatar Jérome Perrin

discover: support a few more restriction lists in queries

parent 12434484
......@@ -1730,7 +1730,7 @@ class XmlaDiscoverTools():
""".format(_catalogues))
def discover_mdschema_cubes_response(self, request):
if request.Restrictions.RestrictionList.CUBE_NAME == self.selected_catalogue \
if request.Restrictions.RestrictionList and request.Restrictions.RestrictionList.CUBE_NAME == self.selected_catalogue \
and request.Properties.PropertyList.Catalog is not None:
self.change_catalogue(request.Properties.PropertyList.Catalog)
if request.Restrictions.RestrictionList.CATALOG_NAME == self.selected_catalogue:
......@@ -1822,8 +1822,8 @@ class XmlaDiscoverTools():
def discover_mdschema_measures__response(self, request):
measures = ""
if request.Restrictions.RestrictionList.CUBE_NAME == self.selected_catalogue and \
request.Restrictions.RestrictionList.MEASURE_VISIBILITY == 3 and\
if request.Restrictions.RestrictionList and\
request.Restrictions.RestrictionList.CUBE_NAME == self.selected_catalogue and \
request.Properties.PropertyList.Catalog is not None:
self.change_catalogue(request.Properties.PropertyList.Catalog)
......@@ -1859,8 +1859,9 @@ class XmlaDiscoverTools():
""".format(measures))
def discover_mdschema_dimensions_response(self, request):
if request.Restrictions.RestrictionList.CUBE_NAME == self.selected_catalogue and\
request.Restrictions.RestrictionList.CATALOG_NAME == self.selected_catalogue and \
if request.Restrictions.RestrictionList and (\
request.Restrictions.RestrictionList.CUBE_NAME == self.selected_catalogue or\
request.Restrictions.RestrictionList.CATALOG_NAME == self.selected_catalogue) and \
request.Properties.PropertyList.Catalog is not None:
self.change_catalogue(request.Properties.PropertyList.Catalog)
......@@ -1920,11 +1921,14 @@ class XmlaDiscoverTools():
request.Properties.PropertyList.Catalog is not None:
self.change_catalogue(request.Properties.PropertyList.Catalog)
if request.Restrictions.RestrictionList.HIERARCHY_VISIBILITY == 3:
if 1: # XXX request.Restrictions.RestrictionList.HIERARCHY_VISIBILITY == 3:
rows = ""
for table_name, df in self.executer.tables_loaded.items():
if table_name == self.executer.facts:
continue
if request.Restrictions.RestrictionList.DIMENSION_UNIQUE_NAME and \
request.Restrictions.RestrictionList.DIMENSION_UNIQUE_NAME != '[{}]'.format(table_name):
continue
# french caracteres
# TODO encode dataframe
......@@ -1959,6 +1963,8 @@ class XmlaDiscoverTools():
""".format(self.selected_catalogue, table_name,
df.columns[0], column_attribut)
if (not request.Restrictions.RestrictionList.DIMENSION_UNIQUE_NAME) or \
request.Restrictions.RestrictionList.DIMENSION_UNIQUE_NAME == '[Measures]':
rows += """
<row>
<CATALOG_NAME>{0}</CATALOG_NAME>
......@@ -2068,13 +2074,16 @@ class XmlaDiscoverTools():
def discover_mdschema_levels__response(self, request):
# TODO fix levels in the same table (with xml file maybe) !!!!!!!!!
if request.Restrictions.RestrictionList.CUBE_NAME == self.selected_catalogue and \
request.Restrictions.RestrictionList.CATALOG_NAME == self.selected_catalogue and \
if (request.Restrictions.RestrictionList.CUBE_NAME == self.selected_catalogue or \
request.Restrictions.RestrictionList.CATALOG_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):
if request.Restrictions.RestrictionList.DIMENSION_UNIQUE_NAME and (
request.Restrictions.RestrictionList.DIMENSION_UNIQUE_NAME != '[{}]'.format(tables)):
continue
l_nb = 0
for col in self.executer.tables_loaded[tables].columns:
rows += """
......@@ -2099,6 +2108,8 @@ class XmlaDiscoverTools():
""".format(self.selected_catalogue, tables, col, l_nb)
l_nb += 1
if not request.Restrictions.RestrictionList.DIMENSION_UNIQUE_NAME or (
request.Restrictions.RestrictionList.DIMENSION_UNIQUE_NAME == '[Measures]'):
rows += """
<row>
<CATALOG_NAME>{0}</CATALOG_NAME>
......
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