diff --git a/cubes/metadata/base.py b/cubes/metadata/base.py index 5e31656c..4ddf958a 100644 --- a/cubes/metadata/base.py +++ b/cubes/metadata/base.py @@ -78,7 +78,7 @@ def localized(self, context): for obj in getattr(acopy, attr): obj_context = context.object_localization(attr, obj.name) list_copy.append(obj.localized(obj_context)) - setattr(acopy, attr, list_copy) + setattr(acopy, "_"+attr, object_dict(list_copy)) return acopy diff --git a/cubes/metadata/cube.py b/cubes/metadata/cube.py index 3517a660..fdae361d 100644 --- a/cubes/metadata/cube.py +++ b/cubes/metadata/cube.py @@ -315,7 +315,7 @@ def aggregate(self, name): there are multiple aggregates with the same name (which also means that the model is not valid). """ - name = str(name) + name = str(name) try: return self._aggregates[name] except KeyError: diff --git a/cubes/query/browser.py b/cubes/query/browser.py index 938c9b81..a55dabfd 100644 --- a/cubes/query/browser.py +++ b/cubes/query/browser.py @@ -240,6 +240,7 @@ def prepare_aggregates(self, aggregates=None, measures=None): not self.is_builtin_function(agg.function) \ and agg.measure not in seen: seen.add(agg.measure) + try: aggregate = self.cube.aggregate(agg.measure) diff --git a/cubes/slicer/commands.py b/cubes/slicer/commands.py index 00656f78..e2df546f 100644 --- a/cubes/slicer/commands.py +++ b/cubes/slicer/commands.py @@ -324,7 +324,7 @@ def read_config(cfg): help="Name of slicer.ini configuration file") def sql(ctx, store, config): """SQL store commands""" - ctx.obj.workspace = cubes.Workspace(config) + ctx.obj.workspace = Workspace(read_config(config)) ctx.obj.store = ctx.obj.workspace.get_store(store) ################################################################################ diff --git a/cubes/sql/browser.py b/cubes/sql/browser.py index e563613e..a701ffb7 100644 --- a/cubes/sql/browser.py +++ b/cubes/sql/browser.py @@ -301,7 +301,9 @@ def provide_members(self, cell, dimension, depth=None, hierarchy=None, (statement, labels) = self.denormalized_statement(attributes, cell) # Order and paginate # - statement = statement.group_by(*statement.columns) + + statement = statement.group_by(*[col._proxies[0] for col in statement.columns]) + #statement = statement.group_by(*statement.columns) statement = order_query(statement, order, labels=labels) @@ -482,7 +484,9 @@ def denormalized_statement(self, attributes=None, cell=None, attributes = attributes or self.cube.all_fact_attributes refs = [attr.ref for attr in collect_attributes(attributes, cell)] + context_attributes = self.cube.get_attributes(refs) + context = self._create_context(context_attributes) if include_fact_key: @@ -491,11 +495,14 @@ def denormalized_statement(self, attributes=None, cell=None, selection = [] names = [attr.ref for attr in attributes] + selection += context.get_columns(names) + cell_condition = context.condition_for_cell(cell) statement = sql.expression.select(selection, + use_labels=True, from_obj=context.star, whereclause=cell_condition) diff --git a/cubes/sql/store.py b/cubes/sql/store.py index b48a8eff..d7f05a49 100644 --- a/cubes/sql/store.py +++ b/cubes/sql/store.py @@ -327,7 +327,7 @@ def create_denormalized_view(self, cube, view_name=None, materialize=False, # Note: this does not work with safe labels – since they are "safe" # they can not conform to the cubes implicit naming schema dim.attr - (statement, _) = browser.denormalized_statement(attributes, + (statement, _) = browser.denormalized_statement([],#cube.get_attributes(), include_fact_key=True) schema = schema or self.naming.schema diff --git a/cubes/workspace.py b/cubes/workspace.py index 7553b48b..e3ada399 100644 --- a/cubes/workspace.py +++ b/cubes/workspace.py @@ -246,7 +246,7 @@ def __init__(self, config=None, stores=None, load_base_model=True, self.ns_languages = defaultdict(dict) for section in config.sections(): if section.startswith("locale"): - lang = section[9:] + lang = section[7:] # namespace -> path for nsname, path in config.items(section): if nsname == "defalt": diff --git a/setup.py b/setup.py index b96e8b60..ea0e5eb9 100644 --- a/setup.py +++ b/setup.py @@ -16,7 +16,7 @@ setup( name="cubes", - version='1.1', + version='1.1.1', # Project uses reStructuredText, so ensure that the docutils get # installed or upgraded on the target machine