Commit c85f307c authored by mouadh's avatar mouadh

fix path

parent 708b16b8
...@@ -17,7 +17,7 @@ def _load_table_config_file(executer_instance, cube_obj): ...@@ -17,7 +17,7 @@ def _load_table_config_file(executer_instance, cube_obj):
# just one facts table right now # just one facts table right now
executer_instance.facts = cube_obj.facts[0].table_name executer_instance.facts = cube_obj.facts[0].table_name
db = MyDB(db=executer_instance.cube) db = MyDB(db_config_file_path=os.path.dirname(executer_instance.cube_path), db=executer_instance.cube)
memory_usage("1 - before executing query //// _load_table_config_file") memory_usage("1 - before executing query //// _load_table_config_file")
for dimension in cube_obj.dimensions: for dimension in cube_obj.dimensions:
...@@ -55,7 +55,7 @@ def _construct_star_schema_config_file(executer_instance, cubes_obj): ...@@ -55,7 +55,7 @@ def _construct_star_schema_config_file(executer_instance, cubes_obj):
:return: star schema DataFrame :return: star schema DataFrame
""" """
executer_instance.facts = cubes_obj.facts[0].table_name executer_instance.facts = cubes_obj.facts[0].table_name
db = MyDB(db=executer_instance.cube) db = MyDB(db_config_file_path=os.path.dirname(executer_instance.cube_path), db=executer_instance.cube)
# load facts table # load facts table
memory_usage("1 - before executing query //// _construct_star_schema_config_file") memory_usage("1 - before executing query //// _construct_star_schema_config_file")
...@@ -69,8 +69,7 @@ def _construct_star_schema_config_file(executer_instance, cubes_obj): ...@@ -69,8 +69,7 @@ def _construct_star_schema_config_file(executer_instance, cubes_obj):
for dimension in cubes_obj.dimensions: for dimension in cubes_obj.dimensions:
if dimension_and_key.split('.')[0] == dimension.name: if dimension_and_key.split('.')[0] == dimension.name:
df.rename(columns=dimension.columns,inplace=True) df.rename(columns=dimension.columns, inplace=True)
# todo test with this # todo test with this
fusion = fusion.merge( fusion = fusion.merge(
...@@ -82,7 +81,6 @@ def _construct_star_schema_config_file(executer_instance, cubes_obj): ...@@ -82,7 +81,6 @@ def _construct_star_schema_config_file(executer_instance, cubes_obj):
# # remove suffixe from dimension and keep the same column name for facts # # remove suffixe from dimension and keep the same column name for facts
# suffixes=('', '_y')) # suffixes=('', '_y'))
memory_usage("2 - after query, before fetchall /////// _construct_star_schema_config_file") memory_usage("2 - after query, before fetchall /////// _construct_star_schema_config_file")
# TODO CHOSE BETWEEN THOSES DF # TODO CHOSE BETWEEN THOSES DF
# if separated dimensions # if separated dimensions
...@@ -123,7 +121,6 @@ def _construct_star_schema_config_file_OLD(executer_instance, cubes_obj): ...@@ -123,7 +121,6 @@ def _construct_star_schema_config_file_OLD(executer_instance, cubes_obj):
fusion = fusion.merge( fusion = fusion.merge(
df, left_on=fact_key, right_on=dimension_and_key.split('.')[1]) df, left_on=fact_key, right_on=dimension_and_key.split('.')[1])
memory_usage("2 - after query, before fetchall /////// _construct_star_schema_config_file") memory_usage("2 - after query, before fetchall /////// _construct_star_schema_config_file")
# TODO CHOSE BETWEEN THOSES DF # TODO CHOSE BETWEEN THOSES DF
# if separated dimensions # if separated dimensions
...@@ -151,20 +148,18 @@ def _construct_web_star_schema_config_file(executer_instance, cubes_obj): ...@@ -151,20 +148,18 @@ def _construct_web_star_schema_config_file(executer_instance, cubes_obj):
all_columns = [] all_columns = []
executer_instance.facts = cubes_obj.facts[0].table_name executer_instance.facts = cubes_obj.facts[0].table_name
db = MyDB(db=executer_instance.cube,db_config_file_path=os.path.dirname(executer_instance.cube_path)) db = MyDB(db_config_file_path=os.path.dirname(executer_instance.cube_path), db=executer_instance.cube)
# load facts table # load facts table
if cubes_obj.facts[0].columns: if cubes_obj.facts[0].columns:
all_columns += cubes_obj.facts[0].columns all_columns += cubes_obj.facts[0].columns
memory_usage("1 - before executing query //// 1111 _construct_web_star_schema_config_file ") memory_usage("1 - before executing query //// 1111 _construct_web_star_schema_config_file ")
fusion = psql.read_sql_query( fusion = psql.read_sql_query(
"SELECT * FROM {0}".format(executer_instance.facts), db.engine) "SELECT * FROM {0}".format(executer_instance.facts), db.engine)
memory_usage("2 - after query, before fetchall /////// 222222222222 _construct_star_schema_config_file") memory_usage("2 - after query, before fetchall /////// 222222222222 _construct_star_schema_config_file")
tables = {} tables = {}
memory_usage("1 - before executing query //// 3333333333 _construct_web_star_schema_config_file ") memory_usage("1 - before executing query //// 3333333333 _construct_web_star_schema_config_file ")
for table in cubes_obj.tables: for table in cubes_obj.tables:
......
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