Constants
pingthings.timeseries.constants
¶
This module contains various static constants and schemas used by the Predictive Grid Platform
pingthings.timeseries.constants.PW
module-attribute
¶
Durations that naturally align with the platform timeseries data structure. Utilizing windowed value queries where the start, end and averaging windows align with these point-widths ensures optimal query performance.
These point-width durations are as follows:
| point-width | number of nanoseconds | duration |
|---|---|---|
PW[0] |
1 | 1 ns |
PW[1] |
2 | 2 ns |
PW[2] |
4 | 4 ns |
PW[3] |
8 | 8 ns |
PW[4] |
16 | 16 ns |
PW[5] |
32 | 32 ns |
PW[6] |
64 | 64 ns |
PW[7] |
128 | 128 ns |
PW[8] |
256 | 256 ns |
PW[9] |
512 | 512 ns |
PW[10] |
1024 | 1 μs 24 ns |
PW[11] |
2048 | 2 μs 48 ns |
PW[12] |
4096 | 4 μs 96 ns |
PW[13] |
8192 | 8 μs 192 ns |
PW[14] |
16384 | 16 μs 384 ns |
PW[15] |
32768 | 32 μs 768 ns |
PW[16] |
65536 | 65 μs 536 ns |
PW[17] |
131072 | 131 μs 72 ns |
PW[18] |
262144 | 262 μs 144 ns |
PW[19] |
524288 | 524 μs 288 ns |
PW[20] |
1.04858e+06 | 1 ms 48 μs 576 ns |
PW[21] |
2.09715e+06 | 2 ms 97 μs 152 ns |
PW[22] |
4.1943e+06 | 4 ms 194 μs 304 ns |
PW[23] |
8.38861e+06 | 8 ms 388 μs 608 ns |
PW[24] |
1.67772e+07 | 16 ms 777 μs 216 ns |
PW[25] |
3.35544e+07 | 33 ms 554 μs 432 ns |
PW[26] |
6.71089e+07 | 67 ms 108 μs 864 ns |
PW[27] |
1.34218e+08 | 134 ms 217 μs 728 ns |
PW[28] |
2.68435e+08 | 268 ms 435 μs 456 ns |
PW[29] |
5.36871e+08 | 536 ms 870 μs 912 ns |
PW[30] |
1.07374e+09 | 1 sec 73 ms 741 μs |
PW[31] |
2.14748e+09 | 2 sec 147 ms 483 μs |
PW[32] |
4.29497e+09 | 4 sec 294 ms 967 μs |
PW[33] |
8.58993e+09 | 8 sec 589 ms 934 μs |
PW[34] |
1.71799e+10 | 17 sec 179 ms 869 μs |
PW[35] |
3.43597e+10 | 34 sec 359 ms 738 μs |
PW[36] |
6.87195e+10 | 1 min 8 sec 719 ms |
PW[37] |
1.37439e+11 | 2 mins 17 sec 438 ms |
PW[38] |
2.74878e+11 | 4 mins 34 sec 877 ms |
PW[39] |
5.49756e+11 | 9 mins 9 sec 755 ms |
PW[40] |
1.09951e+12 | 18 mins 19 sec 511 ms |
PW[41] |
2.19902e+12 | 36 mins 39 sec 23 ms |
PW[42] |
4.39805e+12 | 1 hour 13 mins 18 sec |
PW[43] |
8.79609e+12 | 2 hours 26 mins 36 sec |
PW[44] |
1.75922e+13 | 4 hours 53 mins 12 sec |
PW[45] |
3.51844e+13 | 9 hours 46 mins 24 sec |
PW[46] |
7.03687e+13 | 19 hours 32 mins 48 sec |
PW[47] |
1.40737e+14 | 1 day 15 hours 5 mins |
PW[48] |
2.81475e+14 | 3 days 6 hours 11 mins |
PW[49] |
5.6295e+14 | 6 days 12 hours 22 mins |
PW[50] |
1.1259e+15 | 13 days 44 mins 59 sec |
PW[51] |
2.2518e+15 | 26 days 1 hour 29 mins |
PW[52] |
4.5036e+15 | 52 days 2 hours 59 mins |
PW[53] |
9.0072e+15 | 104 days 5 hours 59 mins |
PW[54] |
1.80144e+16 | 208 days 11 hours 59 mins |
PW[55] |
3.60288e+16 | 1 year 51 days 23 hours |
PW[56] |
7.20576e+16 | 2 years 103 days 23 hours |
PW[57] |
1.44115e+17 | 4 years 207 days 23 hours |
PW[58] |
2.8823e+17 | 9 years 50 days 23 hours |
PW[59] |
5.76461e+17 | 18 years 101 days 23 hours |
PW[60] |
1.15292e+18 | 36 years 203 days 23 hours |
pingthings.timeseries.constants.MINIMUM_TIME
module-attribute
¶
Minimum time the timeseries platform supports.
pingthings.timeseries.constants.MAXIMUM_TIME
module-attribute
¶
Maximum time the timeseries platform supports.
pingthings.timeseries.constants.TIME_VALUE_F64_SCHEMA
module-attribute
¶
TIME_VALUE_F64_SCHEMA: Final[Schema] = schema(
[
field(
"time",
timestamp(unit="ns", tz="UTC"),
nullable=False,
),
field("value", float64(), nullable=False),
]
)
The pyarrow schema that all timeseries inserts are coerced to.
pingthings.timeseries.constants.TIME_VALUE_F32_SCHEMA
module-attribute
¶
TIME_VALUE_F32_SCHEMA: Final[Schema] = schema(
[
field(
"time",
timestamp(unit="ns", tz="UTC"),
nullable=False,
),
field("value", float32(), nullable=False),
]
)
32-bit floating point value column, null values will be represented as NaNs, the default return schema from the platform for raw data queries.
pingthings.timeseries.constants.TIME_VALUE_F32_NULLABLE_VALUE_SCHEMA
module-attribute
¶
TIME_VALUE_F32_NULLABLE_VALUE_SCHEMA: Final[Schema] = (
schema(
[
field(
"time",
timestamp(unit="ns", tz="UTC"),
nullable=False,
),
field("value", float32(), nullable=True),
]
)
)
32-bit floating point value column, where the value column can be nullable instead of NaNs.
pingthings.timeseries.constants.STAT_F32_SCHEMA
module-attribute
¶
STAT_F32_SCHEMA: Final[Schema] = schema(
[
field(
"time",
timestamp("ns", tz="UTC"),
nullable=False,
),
field("min", float32(), nullable=False),
field("mean", float32(), nullable=False),
field("max", float32(), nullable=False),
field("count", uint64(), nullable=False),
field("stddev", float32(), nullable=False),
]
)
32-bit floating point schema for min, mean, max and stddev.
pingthings.timeseries.constants.STAT_F64_SCHEMA
module-attribute
¶
STAT_F64_SCHEMA: Final[Schema] = schema(
[
field(
"time",
timestamp("ns", tz="UTC"),
nullable=False,
),
field("min", float64(), nullable=False),
field("mean", float64(), nullable=False),
field("max", float64(), nullable=False),
field("count", uint64(), nullable=False),
field("stddev", float64(), nullable=False),
]
)
Statistical point data returned by windows and aligned_window queries.
pingthings.timeseries.constants.DEFAULT_CONCURRENCY_LIMIT
module-attribute
¶
Limit on amount of tasks to be scheduled at once.