def _to_model_clause(self): return aa.Clause(logic=aa.Logic( operation=self.operation, operands=[self.operand._to_model_clause()], table_name=self.table_name, name=self.label, ))
def get_example_four_cube( session, varcodes, selected_airline, selected_year=None, selected_reporting_airport=None, ): """ Get 2D cube of number of flight routes per Airline per time period. """ cubes_api = aa.CubesApi(session.api_client) clauses = [create_clause(session, AIRLINE_NAME_CODE, [selected_airline])] if selected_year is not None: clauses.append( create_clause(session, REPORTING_PERIOD_YEARS_CODE, [selected_year])) if selected_reporting_airport is not None: clauses.append( create_clause(session, REPORTING_AIRPORT_CODE, [selected_reporting_airport])) logic = aa.Logic(operation="AND", operands=clauses, table_name="Flight Route") query = create_query(rule=aa.Rule(clause=aa.Clause(logic=logic))) dimensions = [create_dimension(code) for code in varcodes] measure = create_measure() cube = create_cube(query, dimensions, [measure]) cube_result = cubes_api.cubes_calculate_cube_synchronously( session.data_view, session.system, cube=cube) return cube_result
def _to_model_clause(self): return aa.Clause(criteria=aa.Criteria( variable_name=self.variable_name, include=self.include, logic="OR", ignore_case=False, text_match_type="Is", value_rules=[ aa.ValueRule(list_rule=aa.ListRule(list="\t".join(vals), variable_name=var_name)) for var_name, vals in self.value_sets.items() ], table_name=self.table_name, name=self.label, ))
def _to_model_clause(self): return aa.Clause(criteria=aa.Criteria( variable_name=self.variable_name, include=self.include, logic="OR", ignore_case=not self.match_case, text_match_type=self.match_type, value_rules=[ aa.ValueRule(list_rule=aa.ListRule( list="\t".join(self.values), variable_name=self.variable_name, )) ], table_name=self.table_name, name=self.label, ))
def _to_model_clause(self): return aa.Clause(criteria=aa.Criteria( variable_name=self.variable_name, include=self.include, logic="OR", ignore_case=False, text_match_type="Is", value_rules=[ aa.ValueRule( predefined_rule="CustomTimeRule", time_rule=aa.TimeRule(range_low=self.start, range_high=self.end), ) ], table_name=self.table_name, name=self.label, ))
def _to_model_clause(self): return aa.Clause(criteria=aa.Criteria( variable_name=self.variable_name, include=self.include, logic="OR", ignore_case=False, text_match_type="Is", value_rules=[ aa.ValueRule( list_rule=aa.ListRule( list="\t".join(self.values), variable_name=self.variable_name, ), predefined_rule="AdhocDates", ) ], table_name=self.table_name, name=self.label, ))
def _to_model_clause(self): return aa.Clause(criteria=aa.Criteria( variable_name=self.variable_name, include=self.include, logic="OR", ignore_case=False, text_match_type="Is", value_rules=[ aa.ValueRule( predefined_rule="CustomRule", date_rule=aa.DateRule( pattern_frequency="Daily", pattern_interval=1, pattern_days_of_week=["All"], **self._create_range_parameters(), ), ) ], table_name=self.table_name, name=self.label, ))
def _to_model_clause(self): return aa.Clause(sub_selection=aa.SubSelection( selection=self._to_model_selection()))
def _to_model_clause(self): return aa.Clause( # TODO: this may need to be changed depending on # the final shape of the base py-apteco Selection object sub_selection=self.selection._to_model_selection())