Commit 2fe0efa9 authored by mouadh's avatar mouadh

format

parent 4239eed7
......@@ -17,6 +17,7 @@ from ..tools.connection import MyDB
RUNNING_TOX = 'RUNTING_TOX' in os.environ
class MdxEngine:
"""
The principal class for executing a query
......@@ -80,8 +81,7 @@ class MdxEngine:
else:
home_directory = expanduser("~")
location = os.path.join(home_directory, 'olapy-data',
cls.CUBE_FOLDER)
location = os.path.join(home_directory, 'olapy-data', cls.CUBE_FOLDER)
try:
MdxEngine.csv_files_cubes = [
......
......@@ -2,17 +2,22 @@ import psycopg2 as pg
class MyDB(object):
def __init__(self, username='postgres', password='root', db=None,host='localhost'):
def __init__(self,
username='postgres',
password='root',
db=None,
host='localhost'):
if db is None:
self.connection = pg.connect(
"user={0} password={1}".format(username, password))
else:
try:
self.connection = pg.connect("user={0} password={1} dbname='{2}' host='{3}'".
format(username, password, db,host))
self.connection = pg.connect(
"user={0} password={1} dbname='{2}' host='{3}'".format(
username, password, db, host))
except:
print("can't connect")
def __del__(self):
if hasattr(self, 'connection'):
self.connection.close()
\ No newline at end of file
self.connection.close()
......@@ -39,14 +39,13 @@ class XmlaProviderService(ServiceBase):
discover_tools = XmlaDiscoverTools()
SessionId = discover_tools.SessionId
@rpc(
DiscoverRequest,
_returns=AnyXml,
_body_style="bare",
_out_header=Session,
_throws=InvalidCredentialsError
# _throws=AuthenticationError
)
@rpc(DiscoverRequest,
_returns=AnyXml,
_body_style="bare",
_out_header=Session,
_throws=InvalidCredentialsError
# _throws=AuthenticationError
)
def Discover(ctx, request):
"""
the first principle function of xmla protocol
......@@ -70,8 +69,7 @@ class XmlaProviderService(ServiceBase):
if ctx.transport.req_env['QUERY_STRING'] != 'admin':
raise InvalidCredentialsError(
fault_string=
'You do not have permission to access this resource',
fault_string='You do not have permission to access this resource',
fault_object=None)
# raise AuthenticationError()
......@@ -134,11 +132,10 @@ class XmlaProviderService(ServiceBase):
# Execute function must take 2 argument ( JUST 2 ! ) Command and Properties
# we encapsulate them in ExecuteRequest object
@rpc(
ExecuteRequest,
_returns=AnyXml,
_body_style="bare",
_out_header=Session)
@rpc(ExecuteRequest,
_returns=AnyXml,
_body_style="bare",
_out_header=Session)
def Execute(ctx, request):
"""
the second principle function of xmla protocol
......
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