zabgrab.model.query

A fully resolved fetch request.

Module Attributes

CUSTOM

Label for items given on the command line rather than by a template.

Classes

Query(requests, template, server, custom, ...)

Everything needed to fetch and save data, with where each value came from.

Request(label, items)

Items to fetch.

zabgrab.model.query.CUSTOM = '__custom'

Label for items given on the command line rather than by a template. Template names can’t start with “_”, so it can’t clash.

class zabgrab.model.query.Request(label, items)[source]

Bases: object

Items to fetch.

The template is a request; items given on the command line form another.

Parameters:
label

The template’s name, or CUSTOM.

Type:

str

items

The items to fetch (empty: ask which).

Type:

tuple of ItemSpec

class zabgrab.model.query.Query(requests, template, server, custom, start, end, from_text, to_text, resolution, agg, formats, output_dir, output_pattern, timezone, tz, jobs, max_items, mat_text_warn_entries, sources=<factory>, answers=<factory>)[source]

Bases: object

Everything needed to fetch and save data, with where each value came from.

Parameters:
requests

The template’s items and any items given on the command line.

Type:

tuple of Request

template

The template used, if any.

Type:

str or None

server

The server to fetch from: a name or URL, a choice to ask about, or None (ask which configured server to use).

Type:

str or Choice of str or None

custom

Items were added, or data-affecting template values changed, on the command line (or there was no template). Marks automatic file names.

Type:

bool

start, end

The time range, as aware UTC datetimes.

Type:

datetime

from_text, to_text

The time range as given (e.g. "24 hours ago").

Type:

str

resolution

Raw history or hourly trends.

Type:

Resolution

agg

The trend statistics to save (hourly trends only).

Type:

tuple of Agg

formats

Output formats; empty if not set (then taken from the output file name).

Type:

tuple of Format

output_dir, output_pattern

Where automatic file names go, and how they’re built.

Type:

str

timezone

The timezone setting, "local" or an IANA name.

Type:

str

tz

The time zone for times (None for local time).

Type:

tzinfo or None

jobs

How many items to download at once.

Type:

int

max_items

Ask before fetching more items than this.

Type:

int

mat_text_warn_entries

Warn before writing more text values than this to a .mat file.

Type:

int

sources

Where each setting came from, by config key.

Type:

dict of str to str

answers

What the user answered at prompts (filled in as the fetch goes).

Type:

Answers