Skip to content
Browse files

Add support for wildcards in cuts

  • Loading branch information...
1 parent 50dd3ae commit 731ecce89af2f39680d19292fb44bd17f241d36e @pracz pracz committed Oct 5, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 cubes/backends/sql/star.py
View
5 cubes/backends/sql/star.py
@@ -654,7 +654,10 @@ def condition_for_point(self, dim, path, hierarchy=None):
# Prepare condition: dimension.level_key = path_value
column = self.column(level.key)
- conditions.append(column == value)
+ if isinstance(column.type, sqlalchemy.types.TEXT) and '*' in value:
+ conditions.append(column.like(value.replace('*', '%')))
+ else:
+ conditions.append(column == value)
# FIXME: join attributes only if details are requested
# Collect grouping columns

1 comment on commit 731ecce

@Stiivi
Stiivi commented on 731ecce Dec 11, 2012

Despite being sometimes useful feature, it is very unlikely that it is going to be included. Cell references should have well defined coordinates. It would be not trivial to pre-aggregate cells with arbitrarily placed wildcards in keys. I would either suggest to create derived dimensions (or dimension levels/attributes) or to use a search backend (cubes-searhc, experimental though) to find dimension values first and then use SetCut with those values for cell look-up. This feature is also not very portable to other backends.

Please sign in to comment.
Something went wrong with that request. Please try again.