Commit 04472a0d authored by mouadh's avatar mouadh

xmlwitch

parent af02a983
...@@ -311,56 +311,103 @@ class XmlaDiscoverTools(): ...@@ -311,56 +311,103 @@ class XmlaDiscoverTools():
if request.Restrictions.RestrictionList.SchemaName == "MDSCHEMA_HIERARCHIES" and \ if request.Restrictions.RestrictionList.SchemaName == "MDSCHEMA_HIERARCHIES" and \
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)
return etree.fromstring("""
<return> restriction_names = ['CATALOG_NAME',
<root xmlns="urn:schemas-microsoft-com:xml-analysis:rowset" 'SCHEMA_NAME',
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 'CUBE_NAME',
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 'DIMENSION_UNIQUE_NAME',
""" + discover_schema_rowsets_xsd + """ 'HIERARCHY_NAME',
<row> 'HIERARCHY_UNIQUE_NAME',
<SchemaName>MDSCHEMA_HIERARCHIES</SchemaName> 'HIERARCHY_ORIGIN',
<SchemaGuid>C8B522DA-5CF3-11CE-ADE5-00AA0044773D</SchemaGuid> 'CUBE_SOURCE',
<Restrictions> 'HIERARCHY_VISIBILITY']
<Name>CATALOG_NAME</Name> restriction_types = ['string',
<Type>string</Type> 'string',
</Restrictions> 'string',
<Restrictions> 'string',
<Name>SCHEMA_NAME</Name> 'string',
<Type>string</Type> 'string',
</Restrictions> 'unsignedShort',
<Restrictions> 'unsignedShort',
<Name>CUBE_NAME</Name> 'unsignedShort']
<Type>string</Type>
</Restrictions> xml = xmlwitch.Builder()
<Restrictions>
<Name>DIMENSION_UNIQUE_NAME</Name> with xml.root(str(discover_schema_rowsets_xsd), xmlns="urn:schemas-microsoft-com:xml-analysis:rowset",
<Type>string</Type> **{'xmlns:xsd': 'http://www.w3.org/2001/XMLSchema',
</Restrictions> 'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance'}):
<Restrictions>
<Name>HIERARCHY_NAME</Name> for idx, restriction in enumerate(restriction_names):
<Type>string</Type> with xml.row:
</Restrictions> xml.SchemaName('MDSCHEMA_HIERARCHIES')
<Restrictions> xml.SchemaGuid('C8B522DA-5CF3-11CE-ADE5-00AA0044773D')
<Name>HIERARCHY_UNIQUE_NAME</Name> with xml.Restrictions:
<Type>string</Type> xml.Name(restriction)
</Restrictions> xml.Type(restriction_types[idx])
<Restrictions>
<Name>HIERARCHY_ORIGIN</Name> # todo fix this
<Type>unsignedShort</Type> # xml.RestrictionsMask('511')
</Restrictions>
<Restrictions> html_parser = HTMLParser.HTMLParser()
<Name>CUBE_SOURCE</Name> xml = html_parser.unescape(str(xml))
<Type>unsignedShort</Type>
</Restrictions>
<Restrictions> return """
<Name>HIERARCHY_VISIBILITY</Name> <return>
<Type>unsignedShort</Type> {0}
</Restrictions> </return>
<RestrictionsMask>511</RestrictionsMask> """.format(xml)
</row> # return etree.fromstring("""
</root> # <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">
# """ + discover_schema_rowsets_xsd + """
# <row>
# <SchemaName>MDSCHEMA_HIERARCHIES</SchemaName>
# <SchemaGuid>C8B522DA-5CF3-11CE-ADE5-00AA0044773D</SchemaGuid>
# <Restrictions>
# <Name>CATALOG_NAME</Name>
# <Type>string</Type>
# </Restrictions>
# <Restrictions>
# <Name>SCHEMA_NAME</Name>
# <Type>string</Type>
# </Restrictions>
# <Restrictions>
# <Name>CUBE_NAME</Name>
# <Type>string</Type>
# </Restrictions>
# <Restrictions>
# <Name>DIMENSION_UNIQUE_NAME</Name>
# <Type>string</Type>
# </Restrictions>
# <Restrictions>
# <Name>HIERARCHY_NAME</Name>
# <Type>string</Type>
# </Restrictions>
# <Restrictions>
# <Name>HIERARCHY_UNIQUE_NAME</Name>
# <Type>string</Type>
# </Restrictions>
# <Restrictions>
# <Name>HIERARCHY_ORIGIN</Name>
# <Type>unsignedShort</Type>
# </Restrictions>
# <Restrictions>
# <Name>CUBE_SOURCE</Name>
# <Type>unsignedShort</Type>
# </Restrictions>
# <Restrictions>
# <Name>HIERARCHY_VISIBILITY</Name>
# <Type>unsignedShort</Type>
# </Restrictions>
# <RestrictionsMask>511</RestrictionsMask>
# </row>
# </root>
# </return>
# """)
if request.Restrictions.RestrictionList.SchemaName == 'MDSCHEMA_MEASURES' and \ if request.Restrictions.RestrictionList.SchemaName == 'MDSCHEMA_MEASURES' and \
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)
......
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