Module zillion.core¶
AggregationTypes¶
zillion.core.AggregationTypes()Allowed aggregation types. These aggregations are limited by what can be done in most SQL databases
DataSourceQueryModes¶
zillion.core.DataSourceQueryModes()Allowed datasource query modes
ExecutionState¶
zillion.core.ExecutionState()Allowed report/query execution states
FieldTypes¶
zillion.core.FieldTypes()Allowed field types
IfExistsModes¶
zillion.core.IfExistsModes()Allowed modes when creating tables from data. This is based off of pandas if_exists param in the DataFrame.to_sql method, with the addition of an "ignore" option. The "append" option is also removed for now since there isn't a safe/generic way to guarantee a proper primary key has been set on the table.
IfFileExistsModes¶
Bases: zillion.core.IfExistsModes
zillion.core.IfFileExistsModes()An extension of the modes above specific to downloaded files. This allows the config to specify that a downloaded file should be replaced after a certain amount of time. See code that uses this for implementation details.
OrderByTypes¶
zillion.core.OrderByTypes()Allowed Order By Types
RollupTypes¶
zillion.core.RollupTypes()Allowed Rollup Types
TableTypes¶
zillion.core.TableTypes()Allowed table types
TechnicalModes¶
zillion.core.TechnicalModes()Allowed Technical modes
Attributes:
- GROUP - (str) Apply the technical to the last grouping of the data for a multi-dimensional report
- ALL - (str) Apply the technical across all result data
TechnicalTypes¶
zillion.core.TechnicalTypes()Allowed technical types
dbg¶
zillion.core.dbg(msg, **kwargs)Call tlbx dbg with zillion logger
dbgsql¶
zillion.core.dbgsql(msg, **kwargs)Call tlbx dbgsql with zillion logger
dictmerge¶
zillion.core.dictmerge(x, y, path=None, overwrite=False, extend=False)Adapted version of tlbx's dictmerge that supports extending lists
download_file¶
zillion.core.download_file(url, outfile=None)Utility to download a datafile
error¶
zillion.core.error(msg, **kwargs)Call tlbx error with zillion logger
get_modified_time¶
zillion.core.get_modified_time(fname)Utility to get the modified time of a file
get_time_since_modified¶
zillion.core.get_time_since_modified(fname)Utility to get the time since a file was last modified
get_zillion_config_log_level¶
zillion.core.get_zillion_config_log_level()igetattr¶
zillion.core.igetattr(obj, attr, *args)Case-insensitive getattr
info¶
zillion.core.info(msg, **kwargs)Call tlbx info with zillion logger
load_json_or_yaml_from_str¶
zillion.core.load_json_or_yaml_from_str(string, f=None, schema=None)Load the file as json or yaml depending on the extension (if f is a string) or by trying both (if f is not a string). If you know ahead of time that your data is one or the other, you should use yaml or json load directly.
Parameters:
- string - (str) The raw json or yaml string
- f - (str or buffer) A file path or buffer where contents were read from
- schema - (optional) Validate against this schema
Returns:
(dict) - A dict structure loaded from the json/yaml
load_yaml¶
zillion.core.load_yaml(fname)Wrapper to safe_load that also expands environment vars
load_zillion_config¶
zillion.core.load_zillion_config()If the ZILLION_CONFIG environment variable is defined, read the YAML config from this file. Environment variable substitution is supported in the yaml file. Otherwise return a default config. Environment variables prefixed with "ZILLION_" will also be read in (with the prefix stripped) and take precedence.
Returns:
(dict) - The zillion config dict.
powerset¶
zillion.core.powerset(iterable, max_combo_len=None)powerset([1,2,3]) --> () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)
raiseif¶
zillion.core.raiseif(cond, msg='', exc=Convenience assert-like utility
raiseifnot¶
zillion.core.raiseifnot(cond, msg='', exc=Convenience assert-like utility
read_filepath_or_buffer¶
zillion.core.read_filepath_or_buffer(f, open_flags='r', compression=None)Open and read files or buffers, local or remote
set_log_level¶
zillion.core.set_log_level(level)Set the log level for the zillion logger
set_log_level_from_config¶
zillion.core.set_log_level_from_config(cfg)warn¶
zillion.core.warn(msg, **kwargs)Call tlbx warn with zillion logger