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
81e47334
Commit
81e47334
authored
Aug 25, 2017
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
discover: support a few more restriction lists in queries
parent
12434484
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
10 deletions
+21
-10
olapy/core/services/xmla_discover_tools.py
olapy/core/services/xmla_discover_tools.py
+21
-10
No files found.
olapy/core/services/xmla_discover_tools.py
View file @
81e47334
...
@@ -1730,7 +1730,7 @@ class XmlaDiscoverTools():
...
@@ -1730,7 +1730,7 @@ class XmlaDiscoverTools():
"""
.
format
(
_catalogues
))
"""
.
format
(
_catalogues
))
def
discover_mdschema_cubes_response
(
self
,
request
):
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
:
and
request
.
Properties
.
PropertyList
.
Catalog
is
not
None
:
self
.
change_catalogue
(
request
.
Properties
.
PropertyList
.
Catalog
)
self
.
change_catalogue
(
request
.
Properties
.
PropertyList
.
Catalog
)
if
request
.
Restrictions
.
RestrictionList
.
CATALOG_NAME
==
self
.
selected_catalogue
:
if
request
.
Restrictions
.
RestrictionList
.
CATALOG_NAME
==
self
.
selected_catalogue
:
...
@@ -1822,8 +1822,8 @@ class XmlaDiscoverTools():
...
@@ -1822,8 +1822,8 @@ class XmlaDiscoverTools():
def
discover_mdschema_measures__response
(
self
,
request
):
def
discover_mdschema_measures__response
(
self
,
request
):
measures
=
""
measures
=
""
if
request
.
Restrictions
.
RestrictionList
.
CUBE_NAME
==
self
.
selected_catalogue
and
\
if
request
.
Restrictions
.
RestrictionList
and
\
request
.
Restrictions
.
RestrictionList
.
MEASURE_VISIBILITY
==
3
and
\
request
.
Restrictions
.
RestrictionList
.
CUBE_NAME
==
self
.
selected_catalogue
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
)
...
@@ -1859,8 +1859,9 @@ class XmlaDiscoverTools():
...
@@ -1859,8 +1859,9 @@ class XmlaDiscoverTools():
"""
.
format
(
measures
))
"""
.
format
(
measures
))
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
and
(
\
request
.
Restrictions
.
RestrictionList
.
CATALOG_NAME
==
self
.
selected_catalogue
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
:
request
.
Properties
.
PropertyList
.
Catalog
is
not
None
:
self
.
change_catalogue
(
request
.
Properties
.
PropertyList
.
Catalog
)
self
.
change_catalogue
(
request
.
Properties
.
PropertyList
.
Catalog
)
...
@@ -1920,11 +1921,14 @@ class XmlaDiscoverTools():
...
@@ -1920,11 +1921,14 @@ 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
)
if
request
.
Restrictions
.
RestrictionList
.
HIERARCHY_VISIBILITY
==
3
:
if
1
:
# XXX
request.Restrictions.RestrictionList.HIERARCHY_VISIBILITY == 3:
rows
=
""
rows
=
""
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
:
if
table_name
==
self
.
executer
.
facts
:
continue
continue
if
request
.
Restrictions
.
RestrictionList
.
DIMENSION_UNIQUE_NAME
and
\
request
.
Restrictions
.
RestrictionList
.
DIMENSION_UNIQUE_NAME
!=
'[{}]'
.
format
(
table_name
):
continue
# french caracteres
# french caracteres
# TODO encode dataframe
# TODO encode dataframe
...
@@ -1959,7 +1963,9 @@ class XmlaDiscoverTools():
...
@@ -1959,7 +1963,9 @@ class XmlaDiscoverTools():
"""
.
format
(
self
.
selected_catalogue
,
table_name
,
"""
.
format
(
self
.
selected_catalogue
,
table_name
,
df
.
columns
[
0
],
column_attribut
)
df
.
columns
[
0
],
column_attribut
)
rows
+=
"""
if
(
not
request
.
Restrictions
.
RestrictionList
.
DIMENSION_UNIQUE_NAME
)
or
\
request
.
Restrictions
.
RestrictionList
.
DIMENSION_UNIQUE_NAME
==
'[Measures]'
:
rows
+=
"""
<row>
<row>
<CATALOG_NAME>{0}</CATALOG_NAME>
<CATALOG_NAME>{0}</CATALOG_NAME>
<CUBE_NAME>{0}</CUBE_NAME>
<CUBE_NAME>{0}</CUBE_NAME>
...
@@ -2068,13 +2074,16 @@ class XmlaDiscoverTools():
...
@@ -2068,13 +2074,16 @@ class XmlaDiscoverTools():
def
discover_mdschema_levels__response
(
self
,
request
):
def
discover_mdschema_levels__response
(
self
,
request
):
# TODO fix levels in the same table (with xml file maybe) !!!!!!!!!
# TODO fix levels in the same table (with xml file maybe) !!!!!!!!!
if
request
.
Restrictions
.
RestrictionList
.
CUBE_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
.
Restrictions
.
RestrictionList
.
CATALOG_NAME
==
self
.
selected_catalogue
)
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
)
rows
=
""
rows
=
""
for
tables
in
self
.
executer
.
get_all_tables_names
(
ignore_fact
=
True
):
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
l_nb
=
0
for
col
in
self
.
executer
.
tables_loaded
[
tables
].
columns
:
for
col
in
self
.
executer
.
tables_loaded
[
tables
].
columns
:
rows
+=
"""
rows
+=
"""
...
@@ -2099,7 +2108,9 @@ class XmlaDiscoverTools():
...
@@ -2099,7 +2108,9 @@ class XmlaDiscoverTools():
"""
.
format
(
self
.
selected_catalogue
,
tables
,
col
,
l_nb
)
"""
.
format
(
self
.
selected_catalogue
,
tables
,
col
,
l_nb
)
l_nb
+=
1
l_nb
+=
1
rows
+=
"""
if
not
request
.
Restrictions
.
RestrictionList
.
DIMENSION_UNIQUE_NAME
or
(
request
.
Restrictions
.
RestrictionList
.
DIMENSION_UNIQUE_NAME
==
'[Measures]'
):
rows
+=
"""
<row>
<row>
<CATALOG_NAME>{0}</CATALOG_NAME>
<CATALOG_NAME>{0}</CATALOG_NAME>
<CUBE_NAME>{0}</CUBE_NAME>
<CUBE_NAME>{0}</CUBE_NAME>
...
...
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