fireant.dataset package¶
Submodules¶
fireant.dataset.fields module¶
-
class
fireant.dataset.fields.
DataType
[source]¶ Bases:
enum.Enum
An enumeration.
-
boolean
= 4¶
-
date
= 1¶
-
number
= 3¶
-
text
= 2¶
-
-
class
fireant.dataset.fields.
Field
(alias, definition, data_type: fireant.dataset.fields.DataType = number, label=None, hint_table=None, prefix: str = None, suffix: str = None, thousands: str = None, precision: int = None, hyperlink_template: str = None)[source]¶ Bases:
object
The Field class represents a field in the DataSet object. A field is a mapping to a column in a database query.
Parameters: - alias – A unique identifier used to identify the metric when writing slicer queries. This value must be unique over the metrics in the slicer.
- definition – A pypika expression which is used to select the value when building SQL queries. For metrics, this query
must be aggregated, since queries always use a
GROUP BY
clause an metrics are not used as a group. - data_type – {Number, Text, Boolean, Date} When True, the field’s definition should be treated as an aggregate expression.
- label – (optional) A display value used for the metric. This is used for rendering the labels within the visualizations. If not set, the alias will be used as the default.
- hint_table – (optional) An optional table for fetching field choices. If this table is not set, the base table from the field definition will be used.
- is_aggregate – (default: False) When True, the field’s definition should be treated as an aggregate expression.
- precision – (optional) A precision value for rounding decimals. By default, no rounding will be applied.
- prefix – (optional) A prefix for rendering labels in visualizations such as ‘$’
- suffix – A suffix for rendering labels in visualizations such as ‘€’
-
between
(lower, upper)[source]¶ Creates a filter to filter a slicer query.
Parameters: - lower – The start time of the filter. This is the beginning of the window for which results should be included.
- upper – The stop time of the filter. This is the end of the window for which results should be included.
Returns: A slicer query filter used to filter a slicer query to results where this dimension is between the values start and stop.
-
is_
(value: bool)[source]¶ Creates a filter to filter a slicer query.
Parameters: value – True or False Returns: A slicer query filter used to filter a slicer query to results where this dimension is True or False.
-
isin
(values: collections.abc.Iterable)[source]¶ Creates a filter that filters to rows where
Parameters: values – An iterable of value to constrain the slicer query results by. Returns: A slicer query filter used to filter a slicer query to results where this dimension is one of a set of values. Opposite of #notin.
-
notin
(values)[source]¶ Creates a filter to filter a slicer query.
Parameters: values – An iterable of value to constrain the slicer query results by. Returns: A slicer query filter used to filter a slicer query to results where this dimension is not one of a set of values. Opposite of #isin.
Parameters: mutate – When True, overrides the immutable behavior of this decorator.
fireant.dataset.filters module¶
-
class
fireant.dataset.filters.
AntiPatternFilter
(field_alias, dimension_definition, pattern, *patterns)[source]¶
-
class
fireant.dataset.filters.
ComparatorFilter
(field_alias, metric_definition, operator, value)[source]¶
-
class
fireant.dataset.filters.
PatternFilter
(field_alias, dimension_definition, pattern, *patterns)[source]¶
fireant.dataset.intervals module¶
fireant.dataset.joins module¶
fireant.dataset.klass module¶
fireant.dataset.modifiers module¶
-
class
fireant.dataset.modifiers.
DimensionModifier
(wrapped)[source]¶ Bases:
fireant.dataset.modifiers.Modifier
-
wrapped_key
= 'dimension'¶
-
-
class
fireant.dataset.modifiers.
FilterModifier
(wrapped)[source]¶ Bases:
fireant.dataset.modifiers.Modifier
-
wrapped_key
= 'filter'¶
-
-
class
fireant.dataset.modifiers.
Rollup
(wrapped)[source]¶ Bases:
fireant.dataset.modifiers.DimensionModifier
-
definition
¶
-
fireant.dataset.operations module¶
-
class
fireant.dataset.operations.
CumMean
(arg)[source]¶ Bases:
fireant.dataset.operations._Cumulative
-
class
fireant.dataset.operations.
CumProd
(arg)[source]¶ Bases:
fireant.dataset.operations._Cumulative
-
class
fireant.dataset.operations.
Operation
[source]¶ Bases:
object
The Operation class represents an operation in the Slicer API.
-
metrics
¶
-
operations
¶
-
-
class
fireant.dataset.operations.
RollingOperation
(arg, window, min_periods=None)[source]¶ Bases:
fireant.dataset.operations._BaseOperation
Bases:
fireant.dataset.operations._BaseOperation
fireant.dataset.references module¶
-
class
fireant.dataset.references.
Reference
(field, reference_type, delta=False, delta_percent=False)[source]¶ Bases:
object
-
class
fireant.dataset.references.
ReferenceType
(alias, label, time_unit: str, interval: int)[source]¶ Bases:
object
-
fireant.dataset.references.
reference_term
(reference: fireant.dataset.references.Reference, original_query: pypika.queries.QueryBuilder, ref_query: pypika.queries.QueryBuilder)[source]¶ Part of query building. Given a reference, the original slicer query, and the ref query, creates the pypika for the reference that should be selected in the reference container query.
Parameters: - reference –
- original_query –
- ref_query –
Returns:
fireant.dataset.totals module¶
-
fireant.dataset.totals.
get_totals_marker_for_dtype
(dtype)[source]¶ For a given dtype, return the index value to use to indicate that the data frame row contains totals.
Parameters: dtype – Returns:
This function returns a data frame with the values for dimension totals filtered out if the corresponding dimension was not queried with rollup. This comes into play when the share operation is used on metrics which requires the totals across the values.
There are two different logical branches for this function that perform the same work, one on a single-level index data frame and another for a multi-level index.
Parameters: - data_frame – The result data set.
- dimensions – A list of dimensions that were queried for to produce the result data set.
Returns: The data frame with totals rows removed for dimensions that were not queried with rollup.