Decorators

ratelimit

Apply rate limiting at a threshold per second

ratelimit(max_per_second)[source]
Parameters:max_per_second (float) – Number of permitted hits per second

schema_transform

Apply a field name transformation to a data output from the wrapped function, such that specified field names are transformed and unspecified fields are dropped. A valid file would be formatted as shown:

{ “tier0_to_tier1”:
{ “bad_col”: “good_col”,
“another_bad_col”: “another_good_col”

}

}

load_transformer(filename)[source]
schema_transform(filename)[source]
Parameters:filename (str) – A record-oriented JSON file path mapping field names
Returns:Data in the format it was originally passed to the wrapper in, with specified field names transformed and unspecified fields dropped.
schema_transformer(data, *, filename, ignore=[])[source]

Function version of the schema_transformer wrapper. :param data: the data requiring the schama transformation :type data: dataframe OR list of dicts :param filename: the path to the schema json file :type filename: str :param ignore: optional list of fields, eg ids or keys which shouldn’t be dropped :type ignore: list

Returns:supplied data with schema applied