Commit b888ffb9 authored by mouadh's avatar mouadh

fix

parent f015faab
...@@ -58,8 +58,7 @@ class MdxEngine: ...@@ -58,8 +58,7 @@ class MdxEngine:
self.tables_loaded = self.load_tables() self.tables_loaded = self.load_tables()
# all measures # all measures
self.measures = self.get_measures() self.measures = self.get_measures()
self.load_star_schema_dataframe = self.get_star_schema_dataframe( self.load_star_schema_dataframe = self.get_star_schema_dataframe()
cube_name)
self.tables_names = self._get_tables_name() self.tables_names = self._get_tables_name()
# default measure is the first one # default measure is the first one
self.selected_measures = [self.measures[0]] self.selected_measures = [self.measures[0]]
...@@ -369,7 +368,7 @@ class MdxEngine: ...@@ -369,7 +368,7 @@ class MdxEngine:
return fusion return fusion
def get_star_schema_dataframe(self, cube_name, client_type='excel'): def get_star_schema_dataframe(self, client_type='excel'):
""" """
Merge all DataFrames as star schema. Merge all DataFrames as star schema.
...@@ -381,23 +380,23 @@ class MdxEngine: ...@@ -381,23 +380,23 @@ class MdxEngine:
config_file_parser = ConfigParser(self.cube_path) config_file_parser = ConfigParser(self.cube_path)
if config_file_parser.config_file_exist( if config_file_parser.config_file_exist(
client_type client_type
) and cube_name in config_file_parser.get_cubes_names(): ) and self.cube in config_file_parser.get_cubes_names():
for cubes in config_file_parser.construct_cubes(client_type): for cubes in config_file_parser.construct_cubes(client_type):
# TODO cubes.source == 'csv' # TODO cubes.source == 'csv'
if cubes.source == 'postgres': if cubes.source == 'postgres':
# TODO one config file (I will try to merge dimensions between them in web part) # TODO one config file (I will try to merge dimensions between them in web part)
if client_type == 'web': if client_type == 'web':
fusion = self._construct_web_star_schema_config_file( fusion = self._construct_web_star_schema_config_file(
cube_name, cubes) self.cube, cubes)
else: else:
fusion = self._construct_star_schema_config_file( fusion = self._construct_star_schema_config_file(
cube_name, cubes) self.cube, cubes)
elif cube_name in self.csv_files_cubes: elif self.cube in self.csv_files_cubes:
fusion = self._construct_star_schema_csv_files(cube_name) fusion = self._construct_star_schema_csv_files(self.cube)
elif cube_name in self.postgres_db_cubes: elif self.cube in self.postgres_db_cubes:
fusion = self._construct_star_schema_db(cube_name) fusion = self._construct_star_schema_db(self.cube)
return fusion[[ return fusion[[
col for col in fusion.columns if col.lower()[-3:] != '_id' col for col in fusion.columns if col.lower()[-3:] != '_id'
......
...@@ -13,7 +13,7 @@ from spyne.protocol.soap import Soap11 ...@@ -13,7 +13,7 @@ from spyne.protocol.soap import Soap11
from spyne.server.wsgi import WsgiApplication from spyne.server.wsgi import WsgiApplication
from ..mdx.tools.config_file_parser import ConfigParser from ..mdx.tools.config_file_parser import ConfigParser
from ..services.models import DiscoverRequest # , AuthenticationError from ..services.models import DiscoverRequest
from ..services.models import ExecuteRequest, Session from ..services.models import ExecuteRequest, Session
from .xmla_discover_tools import XmlaDiscoverTools from .xmla_discover_tools import XmlaDiscoverTools
from .xmla_execute_tools import XmlaExecuteTools from .xmla_execute_tools import XmlaExecuteTools
......
...@@ -37,7 +37,6 @@ class Nod: ...@@ -37,7 +37,6 @@ class Nod:
log_users = Logs('users') log_users = Logs('users')
log_mdx = Logs('mdx') log_mdx = Logs('mdx')
def __init__(self, text, id, parent): def __init__(self, text, id, parent):
self.text = text self.text = text
self.id = id self.id = id
...@@ -65,8 +64,8 @@ def generate_tree_levels(): ...@@ -65,8 +64,8 @@ def generate_tree_levels():
for c in df.columns[1:]: for c in df.columns[1:]:
for k, v in groupby( for k, v in groupby(
sorted((df.groupby( sorted((df.groupby(
list(df.columns.values[0:df.columns.get_loc(c) + list(df.columns.values[
1])).groups).keys()), 0:df.columns.get_loc(c) + 1])).groups).keys()),
key=itemgetter(*range(0, df.columns.get_loc(c)))): key=itemgetter(*range(0, df.columns.get_loc(c)))):
if type(k) not in [list, tuple]: if type(k) not in [list, tuple]:
...@@ -117,10 +116,11 @@ def login(): ...@@ -117,10 +116,11 @@ def login():
login_user(user, form.remember_me.data) login_user(user, form.remember_me.data)
# next to hold the the page that the user tries to visite # next to hold the the page that the user tries to visite
Nod.log.write_log('connected as ' + str(current_user.username)) Nod.log.write_log('connected as ' + str(current_user.username))
Nod.log_users.write_log('connected as ' + str(current_user.username)) Nod.log_users.write_log('connected as ' +
str(current_user.username))
return redirect( return redirect(
request.args.get('next') or url_for( request.args.get('next') or
'execute', user=current_user)) url_for('execute', user=current_user))
flash('incorrect username or password') flash('incorrect username or password')
return render_template('login.html', form=form, user=current_user) return render_template('login.html', form=form, user=current_user)
...@@ -251,8 +251,9 @@ def stats(): ...@@ -251,8 +251,9 @@ def stats():
return render_template( return render_template(
'stats.html', 'stats.html',
user=current_user, user=current_user,
table_result=temp_rslt.to_html( table_result=temp_rslt.to_html(classes=[
classes=['table table-bordered table-hover table-striped display']), 'table table-bordered table-hover table-striped display'
]),
graphe=graph, graphe=graph,
ids=graph['ids']) ids=graph['ids'])
...@@ -266,12 +267,18 @@ def logs(): ...@@ -266,12 +267,18 @@ def logs():
@app.route('/query_builder', methods=['GET', 'POST']) @app.route('/query_builder', methods=['GET', 'POST'])
@login_required @login_required
def query_builder(): def query_builder():
df = Nod.ex.load_star_schema_dataframe # df = Nod.ex.load_star_schema_dataframe
# if not df.empty:
executer = MdxEngine('mpr')
df = executer.get_star_schema_dataframe(client_type='web')
if not df.empty: if not df.empty:
pivot_ui( pivot_ui(
df, df,
outfile_path="olapy/web/templates/pivottablejs.html", outfile_path="olapy/web/templates/pivottablejs.html",
height="100%") height="100%")
return render_template('query_builder.html', user=current_user) return render_template('query_builder.html', user=current_user)
......
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