Exemplo n.º 1
0
 def verify_response(response):
     """ check if Status Code is OK
     :Parameters:
         `response`: String
             the response that is returned from a method call
     :Exceptions:
         TM1pyException, raises TM1pyException when Code is not 200, 204 etc.
     """
     if not response.ok:
         raise TM1pyException(response.text, status_code=response.status_code, reason=response.reason)
Exemplo n.º 2
0
    def _build_drill_intersection_mdx(dimension_name: str, hierarchy_name: str,
                                      first_element_name: str,
                                      second_element_name: str,
                                      mdx_method: str, recursive: bool) -> str:

        first_member = Member.of(dimension_name, hierarchy_name,
                                 first_element_name)
        second_member = Member.of(dimension_name, hierarchy_name,
                                  second_element_name)

        if not hasattr(MDXDrillMethod, mdx_method.upper()):
            raise TM1pyException(
                'Invalid MDX Drill Method Specified, Options: TM1DrillDownMember or Descendants'
            )
        elif MDXDrillMethod.TM1DRILLDOWNMEMBER.name == mdx_method.upper():
            mdx = MdxHierarchySet.members([first_member]).tm1_drill_down_member(all=True, recursive=recursive) \
                .intersect(MdxHierarchySet.members([second_member])).to_mdx()
        elif MDXDrillMethod.DESCENDANTS.name == mdx_method.upper():
            mdx = MdxHierarchySet.descendants(
                first_member, MdxLevelExpression.member_level(first_member),
                'SELF_AND_AFTER')
        return mdx