Commit b888ffb9 authored by mouadh's avatar mouadh

fix

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