Module preprocessor.report_parameters
Classes
class ParameterConstraint (options: Optional[List[ParameterOption]] = None, min_value: Union[int, float, ForwardRef(None)] = None, max_value: Union[int, float, ForwardRef(None)] = None)
-
Represents the constraints for a specific report query parameter.
Class variables
var max_value : Union[int, float, ForwardRef(None)]
-
For int or float type parameters, defines maximum allowable value for the query parameter.
var min_value : Union[int, float, ForwardRef(None)]
-
For int or float type parameters, defines minimum allowable value for the query parameter.
var options : Optional[List[ParameterOption]]
-
Optional list of allowable query parameter values.
Static methods
def from_dict(kvs: Union[dict, list, str, int, float, bool, ForwardRef(None)], *, infer_missing=False) -> ~A
def from_json(s: Union[str, bytes, bytearray], *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) -> ~A
def schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) -> dataclasses_json.mm.SchemaF[~A]
Methods
def to_dict(self, encode_json=False) -> Dict[str, Union[dict, list, str, int, float, bool, ForwardRef(None)]]
def to_json(self, *, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: Union[int, str, ForwardRef(None)] = None, separators: Tuple[str, str] = None, default: Callable = None, sort_keys: bool = False, **kw) -> str
class ParameterOption (value: Union[str, float, int], display: str = '', desc: str = '')
-
Represents a specific allowable option for a parameter.
Class variables
var desc : str
-
Description of this parameter option.
var display : str
-
Display for this value, what consumers of this report will see.
var value : Union[str, float, int]
-
Allowed parameter value inserted into the query template.
Static methods
def from_dict(kvs: Union[dict, list, str, int, float, bool, ForwardRef(None)], *, infer_missing=False) -> ~A
def from_json(s: Union[str, bytes, bytearray], *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) -> ~A
def schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) -> dataclasses_json.mm.SchemaF[~A]
Methods
def to_dict(self, encode_json=False) -> Dict[str, Union[dict, list, str, int, float, bool, ForwardRef(None)]]
def to_json(self, *, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: Union[int, str, ForwardRef(None)] = None, separators: Tuple[str, str] = None, default: Callable = None, sort_keys: bool = False, **kw) -> str
class ReportParameter (constraint: ParameterConstraint, name: str = '', display: str = '', description: str = '', required: bool = True, param_type: str = 'string', default_value: Union[int, float, str, ForwardRef(None)] = None)
-
Represents a configurable parameter defined in the query template.
Use the provided static create methods for creating report parameters: * create_string * create_float * create_int
A ReportParameter's name can later be used in a report query template as a replaceable value. For example, in the template:
select item, cost from {{table}}
A parameter named "table" could be replace by as String parameter which has possible values of "usa_prices", "canadian_prices" to allow unique reports to be generated from each country.Class variables
var constraint : ParameterConstraint
-
ParameterConstraint representing the constraints for this report parameter.
var default_value : Union[int, float, str, ForwardRef(None)]
-
(Optional) Value to use if not required or specified by the user.
var description : str
-
Description of this report parameter. Can be much longer than the name.
var display : str
-
Name for this report parameter for display to consumers.
var name : str
-
Name of this report parameter, which is also the token to use in the query template.
var param_type : str
-
The type of the parameter, one of: "string", "float", or "integer".
var required : bool
-
Is this parameter required? If not, the default_value can be used when not specified.
Static methods
def create_float(name: str, display: str, description: str, min_value: Optional[float] = None, max_value: Optional[float] = None, default_value: Optional[float] = None, options: Union[List[ParameterOption], List[float], ForwardRef(None)] = None) -> ReportParameter
-
Create a report parameter for a float field.
This defines what values should be allowed for this field when the report is run.
Args
name
:str
- Name of the field in the template. Must match the field to be replaced in the query template.
display
:str
- Display value for this field which will be displayed in the UI.
description
:str
- Field description when displayed in the UI.
min_value
:float
, optional- Represents the minimum allowed value for the query parameter. Required if not populating options.
max_value
:float
, optional- Represents the maximum allowed value for the query parameter. Required if not populating options.
options
:list
, optional- List of possible parameter values for this field when running the report. If supplied, you cannot also specify a min or max value.
default_value
:Optional[float]
- The value this field should default to if it is not provided when the report is run.
Raises
Exception
- When specifying 'options', do not specify a minimum or maximum value.
Exception
- Must supply at least one option.
Exception
- Invalid option type, must be a float or ParameterOption
Exception
- If default_value is specified, it must be one of the values in options
Exception
- Minimum value must be less than maximum.
Exception
- The default_value cannot be less than min_value.
Exception
- The default_value cannot be more than max_value.
Returns
ReportParameter
- New ReportParameter representing the supplied string field.
def create_int(name: str, display: str, description: str, min_value: Optional[int] = None, max_value: Optional[int] = None, default_value: Optional[int] = None, options: Union[List[ParameterOption], List[int], ForwardRef(None)] = None) -> ReportParameter
-
Creates a report parameter for an integer field.
This defines what values should be allowed for this field when the report is run.
Args
name
:str
- Name of the field in the template. Must match the field to be replaced in the query template.
display
:str
- Display value for this field which will be displayed in the UI.
description
:str
- Field description when displayed in the UI.
min_value
:int
, optional- Represents the minimum allowed value for the query parameter. Required if not populating options.
max_value
:int
, optional- Represents the maximum allowed value for the query parameter. Required if not populating options.
options
:list
, optional- List of possible parameter values for this field when running the report. If supplied, you cannot also specify a min or max value.
default_value
:Optional[int]
- The value this field should default to if it is not provided when the report is run.
Raises
Exception
- When specifying 'options', do not specify a minimum or maximum value.
Exception
- Must supply at least one option.
Exception
- Invalid option type, must be an int or ParameterOption
Exception
- If default_value is specified, it must be one of the values in options.
Exception
- Minimum value must be less than maximum.
Exception
- The default_value cannot be less than min_value.
Exception
- The default_value cannot be more than max_value.
Returns
ReportParameter
- New ReportParameter representing the supplied string field.
def create_string(name: str, display: str, description: str, options: List[ParameterOption], default_value: Optional[str] = None) -> ReportParameter
-
Creates a report parameter for a string field.
This defines what values should be allowed for this field when the report is run.
Args
name
:str
- Name of the field in the template. Must match the field to be replaced in the query template.
display
:str
- Display value for this field which will be displayed in the UI.
description
:str
- Field description when displayed in the UI.
options
- List of possible parameter values for this field when running the report.
default_value
- The value this field should default to if it is not provided when the report is run.
Raises
Exception
- Must supply option for a string parameter.
Exception
- Invalid option type, must be a str or ParameterOption.
Exception
- If specified, the default_value must not be blank.
Exception
- If default_value is specified, it must be one of the values in options.
Returns
ReportParameter
- New ReportParameter representing the supplied string field.
def from_dict(kvs: Union[dict, list, str, int, float, bool, ForwardRef(None)], *, infer_missing=False) -> ~A
def from_json(s: Union[str, bytes, bytearray], *, parse_float=None, parse_int=None, parse_constant=None, infer_missing=False, **kw) -> ~A
def schema(*, infer_missing: bool = False, only=None, exclude=(), many: bool = False, context=None, load_only=(), dump_only=(), partial: bool = False, unknown=None) -> dataclasses_json.mm.SchemaF[~A]
Methods
def to_dict(self, encode_json=False) -> Dict[str, Union[dict, list, str, int, float, bool, ForwardRef(None)]]
def to_json(self, *, skipkeys: bool = False, ensure_ascii: bool = True, check_circular: bool = True, allow_nan: bool = True, indent: Union[int, str, ForwardRef(None)] = None, separators: Tuple[str, str] = None, default: Callable = None, sort_keys: bool = False, **kw) -> str