Commit 36e7b345 authored by mouadh's avatar mouadh

format

parent 5e5a898e
...@@ -177,7 +177,6 @@ class XmlaProviderService(ServiceBase): ...@@ -177,7 +177,6 @@ class XmlaProviderService(ServiceBase):
df = executer.execute_mdx() df = executer.execute_mdx()
xmla_tools = XmlaExecuteTools(executer) xmla_tools = XmlaExecuteTools(executer)
# xml = xmlwitch.Builder() # xml = xmlwitch.Builder()
# with xml.OlapInfo(xmla_tools.generate_cell_info()): # with xml.OlapInfo(xmla_tools.generate_cell_info()):
# with xml.CubeInfo: # with xml.CubeInfo:
...@@ -195,10 +194,6 @@ class XmlaProviderService(ServiceBase): ...@@ -195,10 +194,6 @@ class XmlaProviderService(ServiceBase):
# #
# xml.CellData(xmla_tools.generate_cell_data(df)) # xml.CellData(xmla_tools.generate_cell_data(df))
return etree.fromstring(""" return etree.fromstring("""
<return> <return>
<root xmlns="urn:schemas-microsoft-com:xml-analysis:mddataset" <root xmlns="urn:schemas-microsoft-com:xml-analysis:mddataset"
......
...@@ -8,7 +8,6 @@ from collections import OrderedDict ...@@ -8,7 +8,6 @@ from collections import OrderedDict
import xmlwitch import xmlwitch
import HTMLParser import HTMLParser
from lxml import etree from lxml import etree
import os import os
...@@ -61,11 +60,16 @@ class XmlaDiscoverTools(): ...@@ -61,11 +60,16 @@ class XmlaDiscoverTools():
xml = xmlwitch.Builder() xml = xmlwitch.Builder()
with xml['return']: with xml['return']:
with xml.root(discover_datasources_xsd, xmlns="urn:schemas-microsoft-com:xml-analysis:rowset", with xml.root(
**{'xmlns:EX': 'urn:schemas-microsoft-com:xml-analysis:exception', discover_datasources_xsd,
'xmlns:xsd': 'http://www.w3.org/2001/XMLSchema', xmlns="urn:schemas-microsoft-com:xml-analysis:rowset",
'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance'} **{
): 'xmlns:EX':
'urn:schemas-microsoft-com:xml-analysis:exception',
'xmlns:xsd': 'http://www.w3.org/2001/XMLSchema',
'xmlns:xsi':
'http://www.w3.org/2001/XMLSchema-instance'
}):
with xml.row: with xml.row:
xml.DataSourceName('sales') xml.DataSourceName('sales')
xml.DataSourceDescription('sales Sample Data') xml.DataSourceDescription('sales Sample Data')
...@@ -78,7 +82,6 @@ class XmlaDiscoverTools(): ...@@ -78,7 +82,6 @@ class XmlaDiscoverTools():
return xml return xml
def discover_properties_response(self, request): def discover_properties_response(self, request):
def get_props(xsd, PropertyName, PropertyDescription, PropertyType, def get_props(xsd, PropertyName, PropertyDescription, PropertyType,
PropertyAccessType, IsRequired, Value): PropertyAccessType, IsRequired, Value):
...@@ -86,9 +89,15 @@ class XmlaDiscoverTools(): ...@@ -86,9 +89,15 @@ class XmlaDiscoverTools():
if PropertyName is not '': if PropertyName is not '':
with xml['return']: with xml['return']:
with xml.root(xsd, xmlns="urn:schemas-microsoft-com:xml-analysis:rowset", with xml.root(
**{'xmlns:xsd': 'http://www.w3.org/2001/XMLSchema', xsd,
'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance'}): 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'
}):
with xml.row: with xml.row:
xml.PropertyName(PropertyName) xml.PropertyName(PropertyName)
...@@ -99,27 +108,28 @@ class XmlaDiscoverTools(): ...@@ -99,27 +108,28 @@ class XmlaDiscoverTools():
xml.Value(Value) xml.Value(Value)
else: else:
properties_names_n_description = ['ServerName', properties_names_n_description = [
'ProviderVersion', 'ServerName', 'ProviderVersion', 'MdpropMdxSubqueries',
'MdpropMdxSubqueries', 'MdpropMdxDrillFunctions', 'MdpropMdxNamedSets'
'MdpropMdxDrillFunctions', ]
'MdpropMdxNamedSets'] properties_types = ['string', 'string', 'int', 'int', 'int']
properties_types = ['string', values = [
'string', os.getenv('USERNAME', 'default'),
'int', '0.0.3 25-Nov-2016 07:20:28 GMT', '15', '3', '15'
'int', ]
'int']
values = [os.getenv('USERNAME', 'default'),
'0.0.3 25-Nov-2016 07:20:28 GMT',
'15',
'3',
'15']
with xml['return']: with xml['return']:
with xml.root(xsd, xmlns="urn:schemas-microsoft-com:xml-analysis:rowset", with xml.root(
**{'xmlns:xsd': 'http://www.w3.org/2001/XMLSchema', xsd,
'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance'}): xmlns="urn:schemas-microsoft-com:xml-analysis:rowset",
for idx,prop_desc in enumerate(properties_names_n_description): **{
'xmlns:xsd':
'http://www.w3.org/2001/XMLSchema',
'xmlns:xsi':
'http://www.w3.org/2001/XMLSchema-instance'
}):
for idx, prop_desc in enumerate(
properties_names_n_description):
with xml.row: with xml.row:
xml.PropertyName(prop_desc) xml.PropertyName(prop_desc)
xml.PropertyDescription(prop_desc) xml.PropertyDescription(prop_desc)
...@@ -192,345 +202,301 @@ class XmlaDiscoverTools(): ...@@ -192,345 +202,301 @@ class XmlaDiscoverTools():
def discover_schema_rowsets_response(self, request): def discover_schema_rowsets_response(self, request):
rows = [{'SchemaName': 'DBSCHEMA_CATALOGS', rows = [
'SchemaGuid': 'C8B52211-5CF3-11CE-ADE5-00AA0044773D', {
'restrictions': {'restriction_names': ['CATALOG_NAME'], 'SchemaName': 'DBSCHEMA_CATALOGS',
'restriction_types': ['string']}, 'SchemaGuid': 'C8B52211-5CF3-11CE-ADE5-00AA0044773D',
'RestrictionsMask': '1' 'restrictions': {
}, 'restriction_names': ['CATALOG_NAME'],
{'SchemaName': 'DISCOVER_LITERALS', 'restriction_types': ['string']
'SchemaGuid': 'C3EF5ECB-0A07-4665-A140-B075722DBDC2', },
'restrictions': { 'RestrictionsMask': '1'
'restriction_names': ['LiteralName'], },
'restriction_types': ['string']}, {
'RestrictionsMask': '1' 'SchemaName': 'DISCOVER_LITERALS',
}, 'SchemaGuid': 'C3EF5ECB-0A07-4665-A140-B075722DBDC2',
{'SchemaName': 'DISCOVER_PROPERTIES', 'restrictions': {
'SchemaGuid': '4B40ADFB-8B09-4758-97BB-636E8AE97BCF', 'restriction_names': ['LiteralName'],
'restrictions': { 'restriction_types': ['string']
'restriction_names': ['PropertyName'], },
'restriction_types': ['string']}, 'RestrictionsMask': '1'
'RestrictionsMask': '1' },
}, {
{'SchemaName': 'DISCOVER_SCHEMA_ROWSETS', 'SchemaName': 'DISCOVER_PROPERTIES',
'SchemaGuid': 'EEA0302B-7922-4992-8991-0E605D0E5593', 'SchemaGuid': '4B40ADFB-8B09-4758-97BB-636E8AE97BCF',
'restrictions': { 'restrictions': {
'restriction_names': ['SchemaName'], 'restriction_names': ['PropertyName'],
'restriction_types': ['string']}, 'restriction_types': ['string']
'RestrictionsMask': '1' },
}, 'RestrictionsMask': '1'
{'SchemaName': 'DMSCHEMA_MINING_MODELS', },
'SchemaGuid': '3ADD8A77-D8B9-11D2-8D2A-00E029154FDE', {
'restrictions': { 'SchemaName': 'DISCOVER_SCHEMA_ROWSETS',
'restriction_names': ['MODEL_CATALOG', 'SchemaGuid': 'EEA0302B-7922-4992-8991-0E605D0E5593',
'MODEL_SCHEMA', 'restrictions': {
'MODEL_NAME', 'restriction_names': ['SchemaName'],
'MODEL_TYPE', 'restriction_types': ['string']
'SERVICE_NAME', },
'SERVICE_TYPE_ID', 'RestrictionsMask': '1'
'MINING_STRUCTURE'], },
'restriction_types': ['string', {
'string', 'SchemaName': 'DMSCHEMA_MINING_MODELS',
'string', 'SchemaGuid': '3ADD8A77-D8B9-11D2-8D2A-00E029154FDE',
'string', 'restrictions': {
'string', 'restriction_names': [
'unsignedInt', 'MODEL_CATALOG', 'MODEL_SCHEMA', 'MODEL_NAME',
'string']}, 'MODEL_TYPE', 'SERVICE_NAME', 'SERVICE_TYPE_ID',
'RestrictionsMask': '127' 'MINING_STRUCTURE'
}, ],
{'SchemaName': 'MDSCHEMA_ACTIONS', 'restriction_types': [
'SchemaGuid': 'A07CCD08-8148-11D0-87BB-00C04FC33942', 'string', 'string', 'string', 'string', 'string',
'restrictions': { 'unsignedInt', 'string'
'restriction_names': ['CATALOG_NAME', ]
'SCHEMA_NAME', },
'CUBE_NAME', 'RestrictionsMask': '127'
'ACTION_NAME', },
'ACTION_TYPE', {
'COORDINATE', 'SchemaName': 'MDSCHEMA_ACTIONS',
'COORDINATE_TYPE', 'SchemaGuid': 'A07CCD08-8148-11D0-87BB-00C04FC33942',
'INVOCATION', 'restrictions': {
'CUBE_SOURCE'], 'restriction_names': [
'restriction_types': ['string', 'CATALOG_NAME', 'SCHEMA_NAME', 'CUBE_NAME',
'string', 'ACTION_NAME', 'ACTION_TYPE', 'COORDINATE',
'string', 'COORDINATE_TYPE', 'INVOCATION', 'CUBE_SOURCE'
'string', ],
'int', 'restriction_types': [
'string', 'string', 'string', 'string', 'string', 'int',
'int', 'string', 'int', 'int', 'unsignedShort'
'int', ]
'unsignedShort']}, },
'RestrictionsMask': '511' 'RestrictionsMask': '511'
}, },
{'SchemaName': 'MDSCHEMA_CUBES', {
'SchemaGuid': 'C8B522D8-5CF3-11CE-ADE5-00AA0044773D', 'SchemaName': 'MDSCHEMA_CUBES',
'restrictions': { 'SchemaGuid': 'C8B522D8-5CF3-11CE-ADE5-00AA0044773D',
'restriction_names': ['CATALOG_NAME', 'restrictions': {
'SCHEMA_NAME', 'restriction_names': [
'CUBE_NAME', 'CATALOG_NAME', 'SCHEMA_NAME', 'CUBE_NAME',
'CUBE_SOURCE', 'CUBE_SOURCE', 'BASE_CUBE_NAME'
'BASE_CUBE_NAME'], ],
'restriction_types': ['string', 'restriction_types':
'string', ['string', 'string', 'string', 'unsignedShort', 'string']
'string', },
'unsignedShort', 'RestrictionsMask': '31'
'string']}, },
'RestrictionsMask': '31' {
}, 'SchemaName': 'MDSCHEMA_DIMENSIONS',
{'SchemaName': 'MDSCHEMA_DIMENSIONS', 'SchemaGuid': 'C8B522D9-5CF3-11CE-ADE5-00AA0044773D',
'SchemaGuid': 'C8B522D9-5CF3-11CE-ADE5-00AA0044773D', 'restrictions': {
'restrictions': { 'restriction_names': [
'restriction_names': ['CATALOG_NAME', 'CATALOG_NAME', 'SCHEMA_NAME', 'CUBE_NAME',
'SCHEMA_NAME', 'DIMENSION_NAME', 'DIMENSION_UNIQUE_NAME',
'CUBE_NAME', 'CUBE_SOURCE', 'DIMENSION_VISIBILITY'
'DIMENSION_NAME', ],
'DIMENSION_UNIQUE_NAME', 'restriction_types': [
'CUBE_SOURCE', 'string', 'string', 'string', 'string', 'string',
'DIMENSION_VISIBILITY'], 'unsignedShort', 'unsignedShort'
'restriction_types': ['string', ]
'string', },
'string', 'RestrictionsMask': '127'
'string', },
'string', {
'unsignedShort', 'SchemaName': 'MDSCHEMA_FUNCTIONS',
'unsignedShort']}, 'SchemaGuid': 'A07CCD07-8148-11D0-87BB-00C04FC33942',
'RestrictionsMask': '127' 'restrictions': {
}, 'restriction_names': [
{'SchemaName': 'MDSCHEMA_FUNCTIONS', 'LIBRARY_NAME', 'INTERFACE_NAME', 'FUNCTION_NAME',
'SchemaGuid': 'A07CCD07-8148-11D0-87BB-00C04FC33942', 'ORIGIN'
'restrictions': { ],
'restriction_names': ['LIBRARY_NAME', 'restriction_types': ['string', 'string', 'string', 'int']
'INTERFACE_NAME', },
'FUNCTION_NAME', 'RestrictionsMask': '15'
'ORIGIN'], },
'restriction_types': ['string', {
'string', 'SchemaName': 'MDSCHEMA_HIERARCHIES',
'string', 'SchemaGuid': 'C8B522DA-5CF3-11CE-ADE5-00AA0044773D',
'int']}, 'restrictions': {
'RestrictionsMask': '15' 'restriction_names': [
}, 'CATALOG_NAME', 'SCHEMA_NAME', 'CUBE_NAME',
{'SchemaName': 'MDSCHEMA_HIERARCHIES', 'DIMENSION_UNIQUE_NAME', 'HIERARCHY_NAME',
'SchemaGuid': 'C8B522DA-5CF3-11CE-ADE5-00AA0044773D', 'HIERARCHY_UNIQUE_NAME', 'HIERARCHY_ORIGIN',
'restrictions': { 'CUBE_SOURCE', 'HIERARCHY_VISIBILITY'
'restriction_names': ['CATALOG_NAME', ],
'SCHEMA_NAME', 'restriction_types': [
'CUBE_NAME', 'string', 'string', 'string', 'string', 'string',
'DIMENSION_UNIQUE_NAME', 'string', 'unsignedShort', 'unsignedShort',
'HIERARCHY_NAME', 'unsignedShort'
'HIERARCHY_UNIQUE_NAME', ]
'HIERARCHY_ORIGIN', },
'CUBE_SOURCE', 'RestrictionsMask': '511'
'HIERARCHY_VISIBILITY'], },
'restriction_types': ['string', {
'string', 'SchemaName': 'MDSCHEMA_INPUT_DATASOURCES',
'string', 'SchemaGuid': 'A07CCD32-8148-11D0-87BB-00C04FC33942',
'string', 'restrictions': {
'string', 'restriction_names': [
'string', 'CATALOG_NAME', 'SCHEMA_NAME', 'DATASOURCE_NAME',
'unsignedShort', 'DATASOURCE_TYPE'
'unsignedShort', ],
'unsignedShort']}, 'restriction_types':
'RestrictionsMask': '511' ['string', 'string', 'string', 'string']
}, },
{'SchemaName': 'MDSCHEMA_INPUT_DATASOURCES', 'RestrictionsMask': '15'
'SchemaGuid': 'A07CCD32-8148-11D0-87BB-00C04FC33942', },
'restrictions': { {
'restriction_names': ['CATALOG_NAME', 'SchemaName': 'MDSCHEMA_KPIS',
'SCHEMA_NAME', 'SchemaGuid': '2AE44109-ED3D-4842-B16F-B694D1CB0E3F',
'DATASOURCE_NAME', 'restrictions': {
'DATASOURCE_TYPE'], 'restriction_names': [
'restriction_types': ['string', 'CATALOG_NAME', 'SCHEMA_NAME', 'CUBE_NAME', 'KPI_NAME',
'string', 'CUBE_SOURCE'
'string', ],
'string']}, 'restriction_types':
'RestrictionsMask': '15' ['string', 'string', 'string', 'string', 'unsignedShort']
}, },
{'SchemaName': 'MDSCHEMA_KPIS', 'RestrictionsMask': '31'
'SchemaGuid': '2AE44109-ED3D-4842-B16F-B694D1CB0E3F', },
'restrictions': { {
'restriction_names': ['CATALOG_NAME', 'SchemaName': 'MDSCHEMA_LEVELS',
'SCHEMA_NAME', 'SchemaGuid': 'C8B522DB-5CF3-11CE-ADE5-00AA0044773D',
'CUBE_NAME', 'restrictions': {
'KPI_NAME', 'restriction_names': [
'CUBE_SOURCE'], 'CATALOG_NAME', 'SCHEMA_NAME', 'CUBE_NAME',
'restriction_types': ['string', 'DIMENSION_UNIQUE_NAME', 'HIERARCHY_UNIQUE_NAME',
'string', 'LEVEL_NAME', 'LEVEL_UNIQUE_NAME', 'LEVEL_ORIGIN',
'string', 'CUBE_SOURCE', 'LEVEL_VISIBILITY'
'string', ],
'unsignedShort']}, 'restriction_types': [
'RestrictionsMask': '31' 'string', 'string', 'string', 'string', 'string',
}, 'string', 'string', 'unsignedShort', 'unsignedShort',
{'SchemaName': 'MDSCHEMA_LEVELS', 'unsignedShort'
'SchemaGuid': 'C8B522DB-5CF3-11CE-ADE5-00AA0044773D', ]
'restrictions': { },
'restriction_names': ['CATALOG_NAME', 'RestrictionsMask': '1023'
'SCHEMA_NAME', },
'CUBE_NAME', {
'DIMENSION_UNIQUE_NAME', 'SchemaName': 'MDSCHEMA_MEASUREGROUPS',
'HIERARCHY_UNIQUE_NAME', 'SchemaGuid': 'E1625EBF-FA96-42FD-BEA6-DB90ADAFD96B',
'LEVEL_NAME', 'restrictions': {
'LEVEL_UNIQUE_NAME', 'restriction_names': [
'LEVEL_ORIGIN', 'CATALOG_NAME', 'SCHEMA_NAME', 'CUBE_NAME',
'CUBE_SOURCE', 'MEASUREGROUP_NAME'
'LEVEL_VISIBILITY'], ],
'restriction_types': ['string', 'restriction_types':
'string', ['string', 'string', 'string', 'string']
'string', },
'string', 'RestrictionsMask': '15'
'string', },
'string', {
'string', 'SchemaName': 'MDSCHEMA_MEASUREGROUP_DIMENSIONS',
'unsignedShort', 'SchemaGuid': 'A07CCD33-8148-11D0-87BB-00C04FC33942',
'unsignedShort', 'restrictions': {
'unsignedShort']}, 'restriction_names': [
'RestrictionsMask': '1023' 'CATALOG_NAME', 'SCHEMA_NAME', 'CUBE_NAME',
}, 'MEASUREGROUP_NAME', 'DIMENSION_UNIQUE_NAME',
{'SchemaName': 'MDSCHEMA_MEASUREGROUPS', 'DIMENSION_VISIBILITY'
'SchemaGuid': 'E1625EBF-FA96-42FD-BEA6-DB90ADAFD96B', ],
'restrictions': { 'restriction_types': [
'restriction_names': ['CATALOG_NAME', 'string', 'string', 'string', 'string', 'string',
'SCHEMA_NAME', 'unsignedShort'
'CUBE_NAME', ]
'MEASUREGROUP_NAME'], },
'restriction_types': ['string', 'RestrictionsMask': '63'
'string', },
'string', {
'string']}, 'SchemaName': 'MDSCHEMA_MEASURES',
'RestrictionsMask': '15' 'SchemaGuid': 'C8B522DC-5CF3-11CE-ADE5-00AA0044773D',
}, 'restrictions': {
{'SchemaName': 'MDSCHEMA_MEASUREGROUP_DIMENSIONS', 'restriction_names': [
'SchemaGuid': 'A07CCD33-8148-11D0-87BB-00C04FC33942', 'CATALOG_NAME', 'SCHEMA_NAME', 'CUBE_NAME',
'restrictions': { 'MEASURE_NAME', 'MEASURE_UNIQUE_NAME',
'restriction_names': ['CATALOG_NAME', 'MEASUREGROUP_NAME', 'CUBE_SOURCE',
'SCHEMA_NAME', 'MEASURE_VISIBILITY'
'CUBE_NAME', ],
'MEASUREGROUP_NAME', 'restriction_types': [
'DIMENSION_UNIQUE_NAME', 'string', 'string', 'string', 'string', 'string',
'DIMENSION_VISIBILITY'], 'string', 'unsignedShort', 'unsignedShort'
'restriction_types': ['string', ]
'string', },
'string', 'RestrictionsMask': '255'
'string', },
'string', {
'unsignedShort']}, 'SchemaName': 'MDSCHEMA_MEMBERS',
'RestrictionsMask': '63' 'SchemaGuid': 'C8B522DE-5CF3-11CE-ADE5-00AA0044773D',
}, 'restrictions': {
{'SchemaName': 'MDSCHEMA_MEASURES', 'restriction_names': [
'SchemaGuid': 'C8B522DC-5CF3-11CE-ADE5-00AA0044773D', 'CATALOG_NAME', 'SCHEMA_NAME', 'CUBE_NAME',
'restrictions': { 'DIMENSION_UNIQUE_NAME', 'HIERARCHY_UNIQUE_NAME',
'restriction_names': ['CATALOG_NAME', 'LEVEL_UNIQUE_NAME', 'LEVEL_NUMBER', 'MEMBER_NAME',
'SCHEMA_NAME', 'MEMBER_UNIQUE_NAME', 'MEMBER_CAPTION', 'MEMBER_TYPE',
'CUBE_NAME', 'TREE_OP', 'CUBE_SOURCE'
'MEASURE_NAME', ],
'MEASURE_UNIQUE_NAME', 'restriction_types': [
'MEASUREGROUP_NAME', 'string', 'string', 'string', 'string', 'string',
'CUBE_SOURCE', 'string', 'unsignedInt', 'string', 'string', 'string',
'MEASURE_VISIBILITY'], 'int', 'int', 'unsignedShort'
'restriction_types': ['string', ]
'string', },
'string', 'RestrictionsMask': '8191'
'string', },
'string', {
'string', 'SchemaName': 'MDSCHEMA_PROPERTIES',
'unsignedShort', 'SchemaGuid': 'C8B522DD-5CF3-11CE-ADE5-00AA0044773D',
'unsignedShort']}, 'restrictions': {
'RestrictionsMask': '255' 'restriction_names': [
}, 'CATALOG_NAME', 'SCHEMA_NAME', 'CUBE_NAME',
{'SchemaName': 'MDSCHEMA_MEMBERS', 'DIMENSION_UNIQUE_NAME', 'HIERARCHY_UNIQUE_NAME',
'SchemaGuid': 'C8B522DE-5CF3-11CE-ADE5-00AA0044773D', 'LEVEL_UNIQUE_NAME', 'MEMBER_UNIQUE_NAME',
'restrictions': { 'PROPERTY_NAME', 'PROPERTY_TYPE',
'restriction_names': ['CATALOG_NAME', 'PROPERTY_CONTENT_TYPE', 'PROPERTY_ORIGIN',
'SCHEMA_NAME', 'CUBE_SOURCE', 'PROPERTY_VISIBILITY'
'CUBE_NAME', ],
'DIMENSION_UNIQUE_NAME', 'restriction_types': [
'HIERARCHY_UNIQUE_NAME', 'string', 'string', 'string', 'string', 'string',
'LEVEL_UNIQUE_NAME', 'string', 'string', 'string', 'string', 'string',
'LEVEL_NUMBER', 'unsignedShort', 'unsignedShort', 'unsignedShort'
'MEMBER_NAME', ]
'MEMBER_UNIQUE_NAME', },
'MEMBER_CAPTION', 'RestrictionsMask': '8191'
'MEMBER_TYPE', },
'TREE_OP', {
'CUBE_SOURCE'], 'SchemaName': 'MDSCHEMA_SETS',
'restriction_types': ['string', 'SchemaGuid': 'A07CCD0B-8148-11D0-87BB-00C04FC33942',
'string', 'restrictions': {
'string', 'restriction_names': [
'string', 'CATALOG_NAME', 'SCHEMA_NAME', 'CUBE_NAME', 'SET_NAME',
'string', 'SCOPE'
'string', ],
'unsignedInt', 'restriction_types':
'string', ['string', 'string', 'string', 'string', 'int']
'string', },
'string', 'RestrictionsMask': '31'
'int', },
'int', ]
'unsignedShort']},
'RestrictionsMask': '8191'
},
{'SchemaName': 'MDSCHEMA_PROPERTIES',
'SchemaGuid': 'C8B522DD-5CF3-11CE-ADE5-00AA0044773D',
'restrictions': {
'restriction_names': ['CATALOG_NAME',
'SCHEMA_NAME',
'CUBE_NAME',
'DIMENSION_UNIQUE_NAME',
'HIERARCHY_UNIQUE_NAME',
'LEVEL_UNIQUE_NAME',
'MEMBER_UNIQUE_NAME',
'PROPERTY_NAME',
'PROPERTY_TYPE',
'PROPERTY_CONTENT_TYPE',
'PROPERTY_ORIGIN',
'CUBE_SOURCE',
'PROPERTY_VISIBILITY'],
'restriction_types': ['string',
'string',
'string',
'string',
'string',
'string',
'string',
'string',
'string',
'string',
'unsignedShort',
'unsignedShort',
'unsignedShort']},
'RestrictionsMask': '8191'
},
{'SchemaName': 'MDSCHEMA_SETS',
'SchemaGuid': 'A07CCD0B-8148-11D0-87BB-00C04FC33942',
'restrictions': {
'restriction_names': ['CATALOG_NAME',
'SCHEMA_NAME',
'CUBE_NAME',
'SET_NAME',
'SCOPE'],
'restriction_types': ['string',
'string',
'string',
'string',
'int']},
'RestrictionsMask': '31'
},
]
def generate_resp(rows): def generate_resp(rows):
xml = xmlwitch.Builder() xml = xmlwitch.Builder()
with xml['return']: with xml['return']:
with xml.root(discover_schema_rowsets_xsd, xmlns="urn:schemas-microsoft-com:xml-analysis:rowset", with xml.root(
**{'xmlns:xsd': 'http://www.w3.org/2001/XMLSchema', discover_schema_rowsets_xsd,
'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance'}): 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'
}):
for resp_row in rows: for resp_row in rows:
with xml.row: with xml.row:
xml.SchemaName(resp_row['SchemaName']) xml.SchemaName(resp_row['SchemaName'])
xml.SchemaGuid(resp_row['SchemaGuid']) xml.SchemaGuid(resp_row['SchemaGuid'])
for idx, restriction in enumerate(resp_row['restrictions']['restriction_names']): for idx, restriction in enumerate(resp_row[
'restrictions']['restriction_names']):
with xml.Restrictions: with xml.Restrictions:
xml.Name(restriction) xml.Name(restriction)
xml.Type(resp_row['restrictions']['restriction_types'][idx]) xml.Type(resp_row['restrictions'][
'restriction_types'][idx])
xml.RestrictionsMask(resp_row['RestrictionsMask']) xml.RestrictionsMask(resp_row['RestrictionsMask'])
...@@ -543,32 +509,26 @@ class XmlaDiscoverTools(): ...@@ -543,32 +509,26 @@ 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)
restriction_names = ['CATALOG_NAME', restriction_names = [
'SCHEMA_NAME', 'CATALOG_NAME', 'SCHEMA_NAME', 'CUBE_NAME',
'CUBE_NAME', 'DIMENSION_UNIQUE_NAME', 'HIERARCHY_NAME',
'DIMENSION_UNIQUE_NAME', 'HIERARCHY_UNIQUE_NAME', 'HIERARCHY_ORIGIN', 'CUBE_SOURCE',
'HIERARCHY_NAME', 'HIERARCHY_VISIBILITY'
'HIERARCHY_UNIQUE_NAME', ]
'HIERARCHY_ORIGIN', restriction_types = [
'CUBE_SOURCE', 'string', 'string', 'string', 'string', 'string', 'string',
'HIERARCHY_VISIBILITY'] 'unsignedShort', 'unsignedShort', 'unsignedShort'
restriction_types = ['string', ]
'string',
'string', rows = [{
'string', 'SchemaName': 'MDSCHEMA_HIERARCHIES',
'string', 'SchemaGuid': 'C8B522DA-5CF3-11CE-ADE5-00AA0044773D',
'string', 'restrictions': {
'unsignedShort', 'restriction_names': restriction_names,
'unsignedShort', 'restriction_types': restriction_types
'unsignedShort'] },
'RestrictionsMask': '511'
rows = [{'SchemaName': 'MDSCHEMA_HIERARCHIES', }]
'SchemaGuid': 'C8B522DA-5CF3-11CE-ADE5-00AA0044773D',
'restrictions': {'restriction_names': restriction_names,
'restriction_types': restriction_types},
'RestrictionsMask': '511'
}
]
return generate_resp(rows) return generate_resp(rows)
...@@ -577,31 +537,25 @@ class XmlaDiscoverTools(): ...@@ -577,31 +537,25 @@ 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)
restriction_names = [
restriction_names = ['CATALOG_NAME', 'CATALOG_NAME', 'SCHEMA_NAME', 'CUBE_NAME', 'MEASURE_NAME',
'SCHEMA_NAME', 'MEASURE_UNIQUE_NAME', 'MEASUREGROUP_NAME', 'CUBE_SOURCE',
'CUBE_NAME', 'MEASURE_VISIBILITY'
'MEASURE_NAME', ]
'MEASURE_UNIQUE_NAME', restriction_types = [
'MEASUREGROUP_NAME', 'string', 'string', 'string', 'string', 'string', 'string',
'CUBE_SOURCE', 'unsignedShort', 'unsignedShort'
'MEASURE_VISIBILITY'] ]
restriction_types = ['string',
'string', rows = [{
'string', 'SchemaName': 'MDSCHEMA_MEASURES',
'string', 'SchemaGuid': 'C8B522DC-5CF3-11CE-ADE5-00AA0044773D',
'string', 'restrictions': {
'string', 'restriction_names': restriction_names,
'unsignedShort', 'restriction_types': restriction_types
'unsignedShort'] },
'RestrictionsMask': '255'
rows = [{'SchemaName': 'MDSCHEMA_MEASURES', }]
'SchemaGuid': 'C8B522DC-5CF3-11CE-ADE5-00AA0044773D',
'restrictions': {'restriction_names': restriction_names,
'restriction_types': restriction_types},
'RestrictionsMask': '255'
}
]
return generate_resp(rows) return generate_resp(rows)
...@@ -609,52 +563,47 @@ class XmlaDiscoverTools(): ...@@ -609,52 +563,47 @@ class XmlaDiscoverTools():
if request.Properties.PropertyList.Catalog is not None: if request.Properties.PropertyList.Catalog is not None:
return generate_resp(rows) return generate_resp(rows)
rows = [ rows = [{
{'SchemaName': 'DBSCHEMA_TABLES', 'SchemaName': 'DBSCHEMA_TABLES',
'SchemaGuid': 'C8B52229-5CF3-11CE-ADE5-00AA0044773D', 'SchemaGuid': 'C8B52229-5CF3-11CE-ADE5-00AA0044773D',
'restrictions': { 'restrictions': {
'restriction_names': ['TABLE_CATALOG', 'restriction_names': [
'TABLE_SCHEMA', 'TABLE_CATALOG', 'TABLE_SCHEMA', 'TABLE_NAME',
'TABLE_NAME', 'TABLE_TYPE', 'TABLE_OLAP_TYPE'
'TABLE_TYPE', ],
'TABLE_OLAP_TYPE'], 'restriction_types':
'restriction_types': ['string', ['string', 'string', 'string', 'string', 'string']
'string', },
'string', 'RestrictionsMask': '31'
'string', }, {
'string']}, 'SchemaName': 'DISCOVER_DATASOURCES',
'RestrictionsMask': '31' 'SchemaGuid': '06C03D41-F66D-49F3-B1B8-987F7AF4CF18',
}, 'restrictions': {
{'SchemaName': 'DISCOVER_DATASOURCES', 'restriction_names': [
'SchemaGuid': '06C03D41-F66D-49F3-B1B8-987F7AF4CF18', 'DataSourceName', 'URL', 'ProviderName', 'ProviderType',
'restrictions': { 'AuthenticationMode'
'restriction_names': ['DataSourceName', ],
'URL', 'restriction_types':
'ProviderName', ['string', 'string', 'string', 'string', 'string']
'ProviderType', },
'AuthenticationMode'], 'RestrictionsMask': '31'
'restriction_types': ['string', }, {
'string', 'SchemaName': 'DISCOVER_INSTANCES',
'string', 'SchemaGuid': '20518699-2474-4C15-9885-0E947EC7A7E3',
'string', 'restrictions': {
'string']}, 'restriction_names': ['INSTANCE_NAME'],
'RestrictionsMask': '31' 'restriction_types': ['string']
}, },
{'SchemaName': 'DISCOVER_INSTANCES', 'RestrictionsMask': '1'
'SchemaGuid': '20518699-2474-4C15-9885-0E947EC7A7E3', }, {
'restrictions': { 'SchemaName': 'DISCOVER_KEYWORDS',
'restriction_names': ['INSTANCE_NAME'], 'SchemaGuid': '1426C443-4CDD-4A40-8F45-572FAB9BBAA1',
'restriction_types': ['string']}, 'restrictions': {
'RestrictionsMask': '1' 'restriction_names': ['Keyword'],
}, 'restriction_types': ['string']
{'SchemaName': 'DISCOVER_KEYWORDS', },
'SchemaGuid': '1426C443-4CDD-4A40-8F45-572FAB9BBAA1', 'RestrictionsMask': '1'
'restrictions': { }] + rows
'restriction_names': ['Keyword'],
'restriction_types': ['string']},
'RestrictionsMask': '1'
}
] + rows
return generate_resp(rows) return generate_resp(rows)
@staticmethod @staticmethod
...@@ -662,115 +611,136 @@ class XmlaDiscoverTools(): ...@@ -662,115 +611,136 @@ class XmlaDiscoverTools():
if request.Properties.PropertyList.Content == 'SchemaData' \ if request.Properties.PropertyList.Content == 'SchemaData' \
and request.Properties.PropertyList.Format == 'Tabular': and request.Properties.PropertyList.Format == 'Tabular':
rows = [{'LiteralName':'DBLITERAL_CATALOG_NAME', rows = [
'LiteralInvalidChars' : '.', {
'LiteralInvalidStartingChars' : '0123456789', 'LiteralName': 'DBLITERAL_CATALOG_NAME',
'LiteralMaxLength' : '24', 'LiteralInvalidChars': '.',
'LiteralNameEnumValue' : '2' 'LiteralInvalidStartingChars': '0123456789',
}, 'LiteralMaxLength': '24',
{'LiteralName': 'DBLITERAL_CATALOG_SEPARATOR', 'LiteralNameEnumValue': '2'
'LiteralValue': '.', },
'LiteralMaxLength': '0', {
'LiteralNameEnumValue': '3' 'LiteralName': 'DBLITERAL_CATALOG_SEPARATOR',
}, 'LiteralValue': '.',
{'LiteralName': 'DBLITERAL_COLUMN_ALIAS', 'LiteralMaxLength': '0',
'LiteralInvalidChars': "'&quot;[]", 'LiteralNameEnumValue': '3'
'LiteralInvalidStartingChars': '0123456789', },
'LiteralMaxLength': '-1', {
'LiteralNameEnumValue': '5' 'LiteralName': 'DBLITERAL_COLUMN_ALIAS',
}, 'LiteralInvalidChars': "'&quot;[]",
{'LiteralName': 'DBLITERAL_COLUMN_NAME', 'LiteralInvalidStartingChars': '0123456789',
'LiteralInvalidChars': '.', 'LiteralMaxLength': '-1',
'LiteralInvalidStartingChars': '0123456789', 'LiteralNameEnumValue': '5'
'LiteralMaxLength': '-1', },
'LiteralNameEnumValue': '6' {
}, 'LiteralName': 'DBLITERAL_COLUMN_NAME',
{'LiteralName': 'DBLITERAL_CORRELATION_NAME', 'LiteralInvalidChars': '.',
'LiteralInvalidChars': "'&quot;[]", 'LiteralInvalidStartingChars': '0123456789',
'LiteralInvalidStartingChars': '0123456789', 'LiteralMaxLength': '-1',
'LiteralMaxLength': '-1', 'LiteralNameEnumValue': '6'
'LiteralNameEnumValue': '7' },
}, {
{'LiteralName': 'DBLITERAL_CUBE_NAME', 'LiteralName': 'DBLITERAL_CORRELATION_NAME',
'LiteralInvalidChars': '.', 'LiteralInvalidChars': "'&quot;[]",
'LiteralInvalidStartingChars': '0123456789', 'LiteralInvalidStartingChars': '0123456789',
'LiteralMaxLength': '-1', 'LiteralMaxLength': '-1',
'LiteralNameEnumValue': '21' 'LiteralNameEnumValue': '7'
}, },
{'LiteralName': 'DBLITERAL_DIMENSION_NAME', {
'LiteralInvalidChars': '.', 'LiteralName': 'DBLITERAL_CUBE_NAME',
'LiteralInvalidStartingChars': '0123456789', 'LiteralInvalidChars': '.',
'LiteralMaxLength': '-1', 'LiteralInvalidStartingChars': '0123456789',
'LiteralNameEnumValue': '22' 'LiteralMaxLength': '-1',
}, 'LiteralNameEnumValue': '21'
{'LiteralName': 'DBLITERAL_LEVEL_NAME', },
'LiteralInvalidChars': '.', {
'LiteralInvalidStartingChars': '0123456789', 'LiteralName': 'DBLITERAL_DIMENSION_NAME',
'LiteralMaxLength': '-1', 'LiteralInvalidChars': '.',
'LiteralNameEnumValue': '24' 'LiteralInvalidStartingChars': '0123456789',
}, 'LiteralMaxLength': '-1',
{'LiteralName': 'DBLITERAL_MEMBER_NAME', 'LiteralNameEnumValue': '22'
'LiteralInvalidChars': '.', },
'LiteralInvalidStartingChars': '0123456789', {
'LiteralMaxLength': '-1', 'LiteralName': 'DBLITERAL_LEVEL_NAME',
'LiteralNameEnumValue': '25' 'LiteralInvalidChars': '.',
}, 'LiteralInvalidStartingChars': '0123456789',
{'LiteralName': 'DBLITERAL_PROCEDURE_NAME', 'LiteralMaxLength': '-1',
'LiteralInvalidChars': '.', 'LiteralNameEnumValue': '24'
'LiteralInvalidStartingChars': '0123456789', },
'LiteralMaxLength': '-1', {
'LiteralNameEnumValue': '14' 'LiteralName': 'DBLITERAL_MEMBER_NAME',
}, 'LiteralInvalidChars': '.',
{'LiteralName': 'DBLITERAL_PROPERTY_NAME', 'LiteralInvalidStartingChars': '0123456789',
'LiteralInvalidChars': '.', 'LiteralMaxLength': '-1',
'LiteralInvalidStartingChars': '0123456789', 'LiteralNameEnumValue': '25'
'LiteralMaxLength': '-1', },
'LiteralNameEnumValue': '26' {
}, 'LiteralName': 'DBLITERAL_PROCEDURE_NAME',
{'LiteralName': 'DBLITERAL_QUOTE_PREFIX', 'LiteralInvalidChars': '.',
'LiteralValue': '[', 'LiteralInvalidStartingChars': '0123456789',
'LiteralMaxLength': '-1', 'LiteralMaxLength': '-1',
'LiteralNameEnumValue': '15' 'LiteralNameEnumValue': '14'
}, },
{'LiteralName': 'DBLITERAL_QUOTE_SUFFIX', {
'LiteralValue': ']', 'LiteralName': 'DBLITERAL_PROPERTY_NAME',
'LiteralMaxLength': '-1', 'LiteralInvalidChars': '.',
'LiteralNameEnumValue': '28' 'LiteralInvalidStartingChars': '0123456789',
}, 'LiteralMaxLength': '-1',
{'LiteralName': 'DBLITERAL_TABLE_NAME', 'LiteralNameEnumValue': '26'
'LiteralInvalidChars': '.', },
'LiteralInvalidStartingChars': '0123456789', {
'LiteralMaxLength': '-1', 'LiteralName': 'DBLITERAL_QUOTE_PREFIX',
'LiteralNameEnumValue': '17' 'LiteralValue': '[',
}, 'LiteralMaxLength': '-1',
{'LiteralName': 'DBLITERAL_TEXT_COMMAND', 'LiteralNameEnumValue': '15'
'LiteralMaxLength': '-1', },
'LiteralNameEnumValue': '18' {
}, 'LiteralName': 'DBLITERAL_QUOTE_SUFFIX',
{'LiteralName': 'DBLITERAL_USER_NAME', 'LiteralValue': ']',
'LiteralMaxLength': '0', 'LiteralMaxLength': '-1',
'LiteralNameEnumValue': '19' 'LiteralNameEnumValue': '28'
}, },
] {
'LiteralName': 'DBLITERAL_TABLE_NAME',
'LiteralInvalidChars': '.',
'LiteralInvalidStartingChars': '0123456789',
'LiteralMaxLength': '-1',
'LiteralNameEnumValue': '17'
},
{
'LiteralName': 'DBLITERAL_TEXT_COMMAND',
'LiteralMaxLength': '-1',
'LiteralNameEnumValue': '18'
},
{
'LiteralName': 'DBLITERAL_USER_NAME',
'LiteralMaxLength': '0',
'LiteralNameEnumValue': '19'
},
]
xml = xmlwitch.Builder() xml = xmlwitch.Builder()
with xml['return']: with xml['return']:
with xml.root(discover_literals_xsd, xmlns="urn:schemas-microsoft-com:xml-analysis:rowset", with xml.root(
**{'xmlns:xsd': 'http://www.w3.org/2001/XMLSchema', discover_literals_xsd,
'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance'}): 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'
}):
for resp_row in rows: for resp_row in rows:
with xml.row: with xml.row:
for att_name,value in resp_row.items(): for att_name, value in resp_row.items():
xml[att_name](value) xml[att_name](value)
html_parser = HTMLParser.HTMLParser() html_parser = HTMLParser.HTMLParser()
xml = html_parser.unescape(str(xml)) xml = html_parser.unescape(str(xml))
return xml return xml
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 \
and request.Properties.PropertyList.Catalog is not None: and request.Properties.PropertyList.Catalog is not None:
...@@ -779,16 +749,20 @@ class XmlaDiscoverTools(): ...@@ -779,16 +749,20 @@ class XmlaDiscoverTools():
xml = xmlwitch.Builder() xml = xmlwitch.Builder()
with xml['return']: with xml['return']:
xml.root(mdschema_sets_xsd, xmlns="urn:schemas-microsoft-com:xml-analysis:rowset", xml.root(
**{'xmlns:xsd': 'http://www.w3.org/2001/XMLSchema', mdschema_sets_xsd,
'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance'}) 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'
})
html_parser = HTMLParser.HTMLParser() html_parser = HTMLParser.HTMLParser()
xml = html_parser.unescape(str(xml)) xml = html_parser.unescape(str(xml))
return xml return xml
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 \
and request.Properties.PropertyList.Catalog is not None: and request.Properties.PropertyList.Catalog is not None:
...@@ -797,22 +771,31 @@ class XmlaDiscoverTools(): ...@@ -797,22 +771,31 @@ class XmlaDiscoverTools():
xml = xmlwitch.Builder() xml = xmlwitch.Builder()
with xml['return']: with xml['return']:
xml.root(mdschema_kpis_xsd, xmlns="urn:schemas-microsoft-com:xml-analysis:rowset", xml.root(
**{'xmlns:xsd': 'http://www.w3.org/2001/XMLSchema', mdschema_kpis_xsd,
'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance'}) 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'
})
html_parser = HTMLParser.HTMLParser() html_parser = HTMLParser.HTMLParser()
xml = html_parser.unescape(str(xml)) xml = html_parser.unescape(str(xml))
return xml return xml
def discover_dbschema_catalogs_response(self, request): def discover_dbschema_catalogs_response(self, request):
xml = xmlwitch.Builder() xml = xmlwitch.Builder()
with xml['return']: with xml['return']:
with xml.root(dbschema_catalogs_xsd, xmlns="urn:schemas-microsoft-com:xml-analysis:rowset", with xml.root(
**{'xmlns:xsd': 'http://www.w3.org/2001/XMLSchema', dbschema_catalogs_xsd,
'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance'}): 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'
}):
for catalogue in self.catalogues: for catalogue in self.catalogues:
with xml.row: with xml.row:
...@@ -830,16 +813,22 @@ class XmlaDiscoverTools(): ...@@ -830,16 +813,22 @@ class XmlaDiscoverTools():
xml = xmlwitch.Builder() xml = xmlwitch.Builder()
with xml['return']: with xml['return']:
with xml.root(mdschema_cubes_xsd, xmlns="urn:schemas-microsoft-com:xml-analysis:rowset", with xml.root(
**{'xmlns:xsd': 'http://www.w3.org/2001/XMLSchema', mdschema_cubes_xsd,
'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance'}): 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'
}):
with xml.row: with xml.row:
xml.CATALOG_NAME(self.selected_catalogue) xml.CATALOG_NAME(self.selected_catalogue)
xml.CUBE_NAME(self.selected_catalogue) xml.CUBE_NAME(self.selected_catalogue)
xml.CUBE_TYPE('CUBE') xml.CUBE_TYPE('CUBE')
xml.LAST_SCHEMA_UPDATE('2016-07-22T10:41:38') xml.LAST_SCHEMA_UPDATE('2016-07-22T10:41:38')
xml.LAST_DATA_UPDATE('2016-07-22T10:41:38') xml.LAST_DATA_UPDATE('2016-07-22T10:41:38')
xml.DESCRIPTION('MDX ' + self.selected_catalogue + 'results') xml.DESCRIPTION('MDX ' + self.selected_catalogue +
'results')
xml.IS_DRILLTHROUGH_ENABLED('true') xml.IS_DRILLTHROUGH_ENABLED('true')
xml.IS_LINKABLE('false') xml.IS_LINKABLE('false')
xml.IS_WRITE_ENABLED('false') xml.IS_WRITE_ENABLED('false')
...@@ -857,16 +846,20 @@ class XmlaDiscoverTools(): ...@@ -857,16 +846,20 @@ class XmlaDiscoverTools():
xml = xmlwitch.Builder() xml = xmlwitch.Builder()
with xml['return']: with xml['return']:
xml.root(dbschema_tables_xsd, xmlns="urn:schemas-microsoft-com:xml-analysis:rowset", xml.root(
**{'xmlns:xsd': 'http://www.w3.org/2001/XMLSchema', dbschema_tables_xsd,
'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance'}) 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'
})
html_parser = HTMLParser.HTMLParser() html_parser = HTMLParser.HTMLParser()
xml = html_parser.unescape(str(xml)) xml = html_parser.unescape(str(xml))
return xml return xml
def discover_mdschema_measures__response(self, request): def discover_mdschema_measures__response(self, request):
if request.Restrictions.RestrictionList.CUBE_NAME == self.selected_catalogue and \ if request.Restrictions.RestrictionList.CUBE_NAME == self.selected_catalogue and \
request.Restrictions.RestrictionList.MEASURE_VISIBILITY == 3 and\ request.Restrictions.RestrictionList.MEASURE_VISIBILITY == 3 and\
...@@ -877,9 +870,14 @@ class XmlaDiscoverTools(): ...@@ -877,9 +870,14 @@ class XmlaDiscoverTools():
xml = xmlwitch.Builder() xml = xmlwitch.Builder()
with xml['return']: with xml['return']:
with xml.root(mdschema_measures_xsd, xmlns="urn:schemas-microsoft-com:xml-analysis:rowset", with xml.root(
**{'xmlns:xsd': 'http://www.w3.org/2001/XMLSchema', mdschema_measures_xsd,
'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance'}): 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'
}):
for mes in self.executer.measures: for mes in self.executer.measures:
with xml.row: with xml.row:
xml.CATALOG_NAME(self.selected_catalogue) xml.CATALOG_NAME(self.selected_catalogue)
...@@ -900,7 +898,6 @@ class XmlaDiscoverTools(): ...@@ -900,7 +898,6 @@ class XmlaDiscoverTools():
xml = html_parser.unescape(str(xml)) xml = html_parser.unescape(str(xml))
return xml return xml
def discover_mdschema_dimensions_response(self, request): def discover_mdschema_dimensions_response(self, request):
if request.Restrictions.RestrictionList.CUBE_NAME == self.selected_catalogue and\ if request.Restrictions.RestrictionList.CUBE_NAME == self.selected_catalogue and\
request.Restrictions.RestrictionList.CATALOG_NAME == self.selected_catalogue and \ request.Restrictions.RestrictionList.CATALOG_NAME == self.selected_catalogue and \
...@@ -911,11 +908,17 @@ class XmlaDiscoverTools(): ...@@ -911,11 +908,17 @@ class XmlaDiscoverTools():
xml = xmlwitch.Builder() xml = xmlwitch.Builder()
with xml['return']: with xml['return']:
with xml.root(mdschema_dimensions_xsd, xmlns="urn:schemas-microsoft-com:xml-analysis:rowset", with xml.root(
**{'xmlns:xsd': 'http://www.w3.org/2001/XMLSchema', mdschema_dimensions_xsd,
'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance'}): xmlns="urn:schemas-microsoft-com:xml-analysis:rowset",
**{
for tables in self.executer.get_all_tables_names(ignore_fact=True): 'xmlns:xsd': 'http://www.w3.org/2001/XMLSchema',
'xmlns:xsi':
'http://www.w3.org/2001/XMLSchema-instance'
}):
for tables in self.executer.get_all_tables_names(
ignore_fact=True):
with xml.row: with xml.row:
xml.CATALOG_NAME(self.selected_catalogue) xml.CATALOG_NAME(self.selected_catalogue)
xml.CUBE_NAME(self.selected_catalogue) xml.CUBE_NAME(self.selected_catalogue)
...@@ -925,7 +928,8 @@ class XmlaDiscoverTools(): ...@@ -925,7 +928,8 @@ class XmlaDiscoverTools():
xml.DIMENSION_ORDINAL(str(ord)) xml.DIMENSION_ORDINAL(str(ord))
xml.DIMENSION_TYPE('3') xml.DIMENSION_TYPE('3')
xml.DIMENSION_CARDINALITY('23') xml.DIMENSION_CARDINALITY('23')
xml.DEFAULT_HIERARCHY('[' + tables + '].[' + tables + ']') xml.DEFAULT_HIERARCHY('[' + tables + '].[' + tables
+ ']')
xml.IS_VIRTUAL('false') xml.IS_VIRTUAL('false')
xml.IS_READWRITE('false') xml.IS_READWRITE('false')
xml.DIMENSION_UNIQUE_SETTINGS('1') xml.DIMENSION_UNIQUE_SETTINGS('1')
...@@ -952,7 +956,6 @@ class XmlaDiscoverTools(): ...@@ -952,7 +956,6 @@ class XmlaDiscoverTools():
xml = html_parser.unescape(str(xml)) xml = html_parser.unescape(str(xml))
return xml return xml
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
......
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