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
53bc29a8
Commit
53bc29a8
authored
Jul 24, 2017
by
mouadh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xmlwitch
parent
b2b55015
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
89 additions
and
48 deletions
+89
-48
olapy/core/services/xmla.py
olapy/core/services/xmla.py
+89
-48
No files found.
olapy/core/services/xmla.py
View file @
53bc29a8
...
@@ -2,6 +2,8 @@
...
@@ -2,6 +2,8 @@
from
__future__
import
absolute_import
,
division
,
print_function
from
__future__
import
absolute_import
,
division
,
print_function
import
HTMLParser
import
xmlwitch
import
xmlwitch
import
os
import
os
from
datetime
import
datetime
from
datetime
import
datetime
...
@@ -161,14 +163,20 @@ class XmlaProviderService(ServiceBase):
...
@@ -161,14 +163,20 @@ class XmlaProviderService(ServiceBase):
# check if command contains a query
# check if command contains a query
xml
=
xmlwitch
.
Builder
()
xml
=
xmlwitch
.
Builder
()
# xml.return return reserved of course
with
xml
[
'return'
]:
xml
.
root
(
xmlns
=
"urn:schemas-microsoft-com:xml-analysis:empty"
)
xml
.
root
(
xmlns
=
"urn:schemas-microsoft-com:xml-analysis:empty"
)
return
"""
return
str
(
xml
)
<return>
{0}
# xml = xmlwitch.Builder()
</return>
# # xml.return return reserved of course
"""
.
format
(
str
(
xml
))
# xml.root(xmlns="urn:schemas-microsoft-com:xml-analysis:empty")
#
# return """
# <return>
# {0}
# </return>
# """.format(str(xml))
else
:
else
:
XmlaProviderService
.
discover_tools
.
change_catalogue
(
XmlaProviderService
.
discover_tools
.
change_catalogue
(
request
.
Properties
.
PropertyList
.
Catalog
)
request
.
Properties
.
PropertyList
.
Catalog
)
...
@@ -194,46 +202,79 @@ class XmlaProviderService(ServiceBase):
...
@@ -194,46 +202,79 @@ class XmlaProviderService(ServiceBase):
#
#
# xml.CellData(xmla_tools.generate_cell_data(df))
# xml.CellData(xmla_tools.generate_cell_data(df))
return
etree
.
fromstring
(
"""
# todo to check
<return>
xml
=
xmlwitch
.
Builder
()
<root xmlns="urn:schemas-microsoft-com:xml-analysis:mddataset"
with
xml
[
'return'
]:
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
with
xml
.
root
(
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
execute_xsd
,
{0}
xmlns
=
"urn:schemas-microsoft-com:xml-analysis:mddataset"
,
<OlapInfo>
**
{
<CubeInfo>
'xmlns:xsd'
:
'http://www.w3.org/2001/XMLSchema'
,
<Cube>
'xmlns:xsi'
:
<CubeName>Sales</CubeName>
'http://www.w3.org/2001/XMLSchema-instance'
<LastDataUpdate
}):
xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">{7}</LastDataUpdate>
with
xml
.
OlapInfo
(
xmla_tools
.
generate_cell_info
()):
<LastSchemaUpdate
with
xml
.
CubeInfo
:
xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">{7}</LastSchemaUpdate>
with
xml
.
Cube
:
</Cube>
xml
.
CubeName
(
'Sales'
)
</CubeInfo>
xml
.
LastDataUpdate
(
datetime
.
now
().
strftime
(
'%Y-%m-%dT%H:%M:%S'
),
<AxesInfo>
xmlns
=
"http://schemas.microsoft.com/analysisservices/2003/engine"
)
{1}
xml
.
LastSchemaUpdate
(
datetime
.
now
().
strftime
(
'%Y-%m-%dT%H:%M:%S'
),
{2}
xmlns
=
"http://schemas.microsoft.com/analysisservices/2003/engine"
)
</AxesInfo>
{3}
xml
.
AxesInfo
(
xmla_tools
.
generate_axes_info
(
df
),
</OlapInfo>
xmla_tools
.
generate_axes_info_slicer
(
df
))
<Axes>
{4}
xml
.
Axes
(
xmla_tools
.
generate_xs0
(
df
),
{5}
xmla_tools
.
generate_slicer_axis
(
df
))
</Axes>
<CellData>
xml
.
CellData
(
xmla_tools
.
generate_cell_data
(
df
))
{6}
</CellData>
html_parser
=
HTMLParser
.
HTMLParser
()
</root>
xml
=
html_parser
.
unescape
(
str
(
xml
)).
replace
(
'&'
,
'&'
)
</return>
"""
.
format
(
execute_xsd
,
return
xml
xmla_tools
.
generate_axes_info
(
df
),
xmla_tools
.
generate_axes_info_slicer
(
df
),
# return etree.fromstring("""
xmla_tools
.
generate_cell_info
(),
# <return>
xmla_tools
.
generate_xs0
(
df
),
# <root xmlns="urn:schemas-microsoft-com:xml-analysis:mddataset"
xmla_tools
.
generate_slicer_axis
(
df
),
# xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmla_tools
.
generate_cell_data
(
df
),
# xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
datetime
.
now
().
strftime
(
'%Y-%m-%dT%H:%M:%S'
)).
replace
(
# {0}
'&'
,
'&'
))
# <OlapInfo>
# <CubeInfo>
# <Cube>
# <CubeName>Sales</CubeName>
# <LastDataUpdate
# xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">{7}</LastDataUpdate>
# <LastSchemaUpdate
# xmlns="http://schemas.microsoft.com/analysisservices/2003/engine">{7}</LastSchemaUpdate>
# </Cube>
# </CubeInfo>
# <AxesInfo>
# {1}
# {2}
# </AxesInfo>
# {3}
# </OlapInfo>
# <Axes>
# {4}
# {5}
# </Axes>
# <CellData>
# {6}
# </CellData>
# </root>
# </return>
# """.format(execute_xsd,
# xmla_tools.generate_axes_info(df),
# xmla_tools.generate_axes_info_slicer(df),
# xmla_tools.generate_cell_info(),
# xmla_tools.generate_xs0(df),
# xmla_tools.generate_slicer_axis(df),
# xmla_tools.generate_cell_data(df),
# datetime.now().strftime('%Y-%m-%dT%H:%M:%S')).replace(
# '&', '&'))
# Problem:
# Problem:
# An XML parser returns the error “xmlParseEntityRef: noname”
# An XML parser returns the error “xmlParseEntityRef: noname”
...
...
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