Commit d9c36831 authored by mouadh's avatar mouadh

fix path

parent 8928af7a
...@@ -82,7 +82,7 @@ class MdxEngine: ...@@ -82,7 +82,7 @@ class MdxEngine:
# surrended with try, except and PASS so we continue getting cubes from different # surrended with try, except and PASS so we continue getting cubes from different
# sources (db, csv...) without interruption # sources (db, csv...) without interruption
if cls.DATA_FOLDER is not None: if cls.DATA_FOLDER is not None:
home_directory = cls.DATA_FOLDER home_directory = os.path.dirname(cls.DATA_FOLDER)
elif RUNNING_TOX: elif RUNNING_TOX:
home_directory = os.environ.get('HOME_DIR') home_directory = os.environ.get('HOME_DIR')
else: else:
...@@ -90,22 +90,24 @@ class MdxEngine: ...@@ -90,22 +90,24 @@ class MdxEngine:
location = os.path.join(home_directory, 'olapy-data', cls.CUBE_FOLDER) location = os.path.join(home_directory, 'olapy-data', cls.CUBE_FOLDER)
# surrended with try, except and PASS so we continue getting cubes from different
# sources (db, csv...) without interruption
try: try:
MdxEngine.csv_files_cubes = [ MdxEngine.csv_files_cubes = [
file for file in os.listdir(location) file for file in os.listdir(location)
if os.path.isdir(os.path.join(location, file)) if os.path.isdir(os.path.join(location, file))
] ]
except Exception: except Exception:
print('no csv folders') print('no csv folders')
pass pass
# get postgres databases # get postgres databases
# surrended with try, except and PASS so we continue getting cubes from different
# sources (db, csv...) without interruption
try: try:
db = MyDB(db_config_file_path=cls.DATA_FOLDER) db = MyDB(db_config_file_path=cls.DATA_FOLDER)
connection = db.engine
# TODO this work only with postgres # TODO this work only with postgres
result = connection.execute('SELECT datname FROM pg_database WHERE datistemplate = false;') result = db.engine.execute('SELECT datname FROM pg_database WHERE datistemplate = false;')
available_tables = result.fetchall() available_tables = result.fetchall()
# cursor.execute("""SELECT datname FROM pg_database # cursor.execute("""SELECT datname FROM pg_database
# WHERE datistemplate = false;""") # WHERE datistemplate = false;""")
......
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