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
79f5c215
Commit
79f5c215
authored
Jul 20, 2017
by
mouadh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
format
parent
7e36a6be
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
41 deletions
+62
-41
olapy/core/services/xmla_discover_tools.py
olapy/core/services/xmla_discover_tools.py
+62
-41
No files found.
olapy/core/services/xmla_discover_tools.py
View file @
79f5c215
...
...
@@ -974,34 +974,40 @@ class XmlaDiscoverTools():
mdschema_hierarchies_xsd
,
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'
}):
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
:
continue
# french caracteres
# TODO encode dataframe
if
type
(
df
.
iloc
[
0
][
0
])
==
unicode
:
column_attribut
=
df
.
iloc
[
0
][
0
].
encode
(
'utf-8'
,
'replace'
)
column_attribut
=
df
.
iloc
[
0
][
0
].
encode
(
'utf-8'
,
'replace'
)
else
:
column_attribut
=
df
.
iloc
[
0
][
0
]
with
xml
.
row
:
xml
.
CATALOG_NAME
(
self
.
selected_catalogue
)
xml
.
CUBE_NAME
(
self
.
selected_catalogue
)
xml
.
DIMENSION_UNIQUE_NAME
(
'['
+
table_name
+
']'
)
xml
.
DIMENSION_UNIQUE_NAME
(
'['
+
table_name
+
']'
)
xml
.
HIERARCHY_NAME
(
table_name
)
xml
.
HIERARCHY_UNIQUE_NAME
(
'[{0}].[{0}]'
.
format
(
table_name
))
xml
.
HIERARCHY_UNIQUE_NAME
(
'[{0}].[{0}]'
.
format
(
table_name
))
xml
.
HIERARCHY_CAPTION
(
table_name
)
xml
.
DIMENSION_TYPE
(
'3'
)
xml
.
HIERARCHY_CARDINALITY
(
'6'
)
xml
.
DEFAULT_MEMBER
(
'[{0}].[{0}].[{1}].[{2}]'
.
format
(
table_name
,
df
.
columns
[
0
],
column_attribut
))
xml
.
DEFAULT_MEMBER
(
'[{0}].[{0}].[{1}].[{2}]'
.
format
(
table_name
,
df
.
columns
[
0
],
column_attribut
))
xml
.
STRUCTURE
(
'0'
)
xml
.
IS_VIRTUAL
(
'false'
)
xml
.
IS_READWRITE
(
'false'
)
...
...
@@ -1022,7 +1028,8 @@ class XmlaDiscoverTools():
xml
.
HIERARCHY_CAPTION
(
'Measures'
)
xml
.
DIMENSION_TYPE
(
'2'
)
xml
.
HIERARCHY_CARDINALITY
(
'0'
)
xml
.
DEFAULT_MEMBER
(
'[Measures].[{0}]'
.
format
(
self
.
executer
.
measures
[
0
]))
xml
.
DEFAULT_MEMBER
(
'[Measures].[{0}]'
.
format
(
self
.
executer
.
measures
[
0
]))
xml
.
STRUCTURE
(
'0'
)
xml
.
IS_VIRTUAL
(
'false'
)
xml
.
IS_READWRITE
(
'false'
)
...
...
@@ -1058,17 +1065,20 @@ class XmlaDiscoverTools():
'http://www.w3.org/2001/XMLSchema-instance'
}):
for
tables
in
self
.
executer
.
get_all_tables_names
(
ignore_fact
=
True
):
for
tables
in
self
.
executer
.
get_all_tables_names
(
ignore_fact
=
True
):
l_nb
=
0
for
col
in
self
.
executer
.
tables_loaded
[
tables
].
columns
:
with
xml
.
row
:
xml
.
CATALOG_NAME
(
self
.
selected_catalogue
)
xml
.
CUBE_NAME
(
self
.
selected_catalogue
)
xml
.
DIMENSION_UNIQUE_NAME
(
'['
+
tables
+
']'
)
xml
.
HIERARCHY_UNIQUE_NAME
(
'[{0}].[{0}]'
.
format
(
tables
))
xml
.
DIMENSION_UNIQUE_NAME
(
'['
+
tables
+
']'
)
xml
.
HIERARCHY_UNIQUE_NAME
(
'[{0}].[{0}]'
.
format
(
tables
))
xml
.
LEVEL_NAME
(
str
(
col
))
xml
.
LEVEL_UNIQUE_NAME
(
'[{0}].[{0}].[{1}]'
.
format
(
tables
,
col
))
xml
.
LEVEL_UNIQUE_NAME
(
'[{0}].[{0}].[{1}]'
.
format
(
tables
,
col
))
xml
.
LEVEL_CAPTION
(
str
(
col
))
xml
.
LEVEL_NUMBER
(
str
(
l_nb
))
xml
.
LEVEL_CARDINALITY
(
'0'
)
...
...
@@ -1149,7 +1159,8 @@ class XmlaDiscoverTools():
'xmlns:xsi'
:
'http://www.w3.org/2001/XMLSchema-instance'
}):
for
tables
in
self
.
executer
.
get_all_tables_names
(
ignore_fact
=
True
):
for
tables
in
self
.
executer
.
get_all_tables_names
(
ignore_fact
=
True
):
with
xml
.
row
:
xml
.
CATALOG_NAME
(
self
.
selected_catalogue
)
xml
.
CUBE_NAME
(
self
.
selected_catalogue
)
...
...
@@ -1159,25 +1170,33 @@ class XmlaDiscoverTools():
xml
.
DIMENSION_CARDINALITY
(
'MANY'
)
xml
.
DIMENSION_IS_VISIBLE
(
'true'
)
xml
.
DIMENSION_IS_FACT_DIMENSION
(
'false'
)
xml
.
DIMENSION_GRANULARITY
(
'[{0}].[{0}]'
.
format
(
tables
))
xml
.
DIMENSION_GRANULARITY
(
'[{0}].[{0}]'
.
format
(
tables
))
html_parser
=
HTMLParser
.
HTMLParser
()
xml
=
html_parser
.
unescape
(
str
(
xml
))
return
xml
def
discover_mdschema_properties_response
(
self
,
request
):
xml
=
xmlwitch
.
Builder
()
if
request
.
Restrictions
.
RestrictionList
.
PROPERTY_TYPE
==
2
and
\
request
.
Properties
.
PropertyList
.
Catalog
is
not
None
:
properties_names
=
[
'FONT_FLAGS'
,
'LANGUAGE'
,
'style'
,
'ACTION_TYPE'
,
'FONT_SIZE'
,
'FORMAT_STRING'
,
'className'
,
'UPDATEABLE'
,
'BACK_COLOR'
,
'CELL_ORDINAL'
,
'FONT_NAME'
,
'VALUE'
,
'FORMATTED_VALUE'
,
'FORE_COLOR'
]
properties_captions
=
[
'FONT_FLAGS'
,
'LANGUAGE'
,
'style'
,
'ACTION_TYPE'
,
'FONT_SIZE'
,
'FORMAT_STRING'
,
'className'
,
'UPDATEABLE'
,
'BACK_COLOR'
,
'CELL_ORDINAL'
,
'FONT_NAME'
,
'VALUE'
,
'FORMATTED_VALUE'
,
'FORE_COLOR'
]
properties_datas
=
[
'3'
,
'19'
,
'130'
,
'19'
,
'18'
,
'130'
,
'130'
,
'19'
,
'19'
,
'19'
,
'130'
,
'12'
,
'130'
,
'19'
]
properties_names
=
[
'FONT_FLAGS'
,
'LANGUAGE'
,
'style'
,
'ACTION_TYPE'
,
'FONT_SIZE'
,
'FORMAT_STRING'
,
'className'
,
'UPDATEABLE'
,
'BACK_COLOR'
,
'CELL_ORDINAL'
,
'FONT_NAME'
,
'VALUE'
,
'FORMATTED_VALUE'
,
'FORE_COLOR'
]
properties_captions
=
[
'FONT_FLAGS'
,
'LANGUAGE'
,
'style'
,
'ACTION_TYPE'
,
'FONT_SIZE'
,
'FORMAT_STRING'
,
'className'
,
'UPDATEABLE'
,
'BACK_COLOR'
,
'CELL_ORDINAL'
,
'FONT_NAME'
,
'VALUE'
,
'FORMATTED_VALUE'
,
'FORE_COLOR'
]
properties_datas
=
[
'3'
,
'19'
,
'130'
,
'19'
,
'18'
,
'130'
,
'130'
,
'19'
,
'19'
,
'19'
,
'130'
,
'12'
,
'130'
,
'19'
]
self
.
change_catalogue
(
request
.
Properties
.
PropertyList
.
Catalog
)
...
...
@@ -1190,7 +1209,7 @@ class XmlaDiscoverTools():
'xmlns:xsi'
:
'http://www.w3.org/2001/XMLSchema-instance'
}):
for
idx
,
prop_name
in
enumerate
(
properties_names
):
for
idx
,
prop_name
in
enumerate
(
properties_names
):
with
xml
.
row
:
xml
.
CATALOG_NAME
(
self
.
selected_catalogue
)
xml
.
PROPERTY_TYPE
(
'2'
)
...
...
@@ -1217,7 +1236,6 @@ class XmlaDiscoverTools():
xml
=
html_parser
.
unescape
(
str
(
xml
))
return
xml
def
discover_mdschema_members_response
(
self
,
request
):
# Enumeration of hierarchies in all dimensions
if
request
.
Restrictions
.
RestrictionList
.
CUBE_NAME
==
self
.
selected_catalogue
and
\
...
...
@@ -1248,12 +1266,15 @@ class XmlaDiscoverTools():
xml
.
CATALOG_NAME
(
self
.
selected_catalogue
)
xml
.
CUBE_NAME
(
self
.
selected_catalogue
)
xml
.
DIMENSION_UNIQUE_NAME
(
separed_tuple
[
0
])
xml
.
HIERARCHY_UNIQUE_NAME
(
'{0}.{0}'
.
format
(
separed_tuple
[
0
]))
xml
.
HIERARCHY_UNIQUE_NAME
(
'{0}.{0}'
.
format
(
separed_tuple
[
0
]))
xml
.
LEVEL_UNIQUE_NAME
(
joined
)
xml
.
LEVEL_NUMBER
(
'0'
)
xml
.
MEMBER_ORDINAL
(
'0'
)
xml
.
MEMBER_NAME
(
last_attribut
)
xml
.
MEMBER_UNIQUE_NAME
(
request
.
Restrictions
.
RestrictionList
.
MEMBER_UNIQUE_NAME
)
xml
.
MEMBER_UNIQUE_NAME
(
request
.
Restrictions
.
RestrictionList
.
MEMBER_UNIQUE_NAME
)
xml
.
MEMBER_TYPE
(
'1'
)
xml
.
MEMBER_CAPTION
(
last_attribut
)
xml
.
CHILDREN_CARDINALITY
(
'1'
)
...
...
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