InfluxDBms¶
The cInfluxDB class¶
- class InfluxDBms.influxdb_tools.cInfluxDB(config_path, timeout=500000)[source]¶
Bases:
object- Parameters:
config_path (str)
timeout (int)
- debug_fields()[source]¶
Prints all available field names (_field) in the bucket to check what can be queried.
- query_data(from_date, to_date, qtok, pie, metrics=None)[source]¶
Query data in InfluxDB, pivoting the results to get the metrics in columns.
- Parameters:
from_date (datetime) – Start date (ISO 8601 format: ‘YYYYY’-MM-DDTHH:MM:SSZ).
to_date (datetime) – End date (ISO 8601 format: ‘YYYYY’-MM-DDTHH:MM:SSZ).
qtok (str) – CodeID
pie (str) – Left or Right foot (‘Right’, ‘Left’)
metrics (list[str], optional) – List of metrics to query (default: predefined set)
- Returns:
DataFrame with the metrics pivoted on columns, ordered by _time descending.
- Return type:
pd.DataFrame
- query_with_aggregate_window(from_date, to_date, window_size='20ms', qtok=None, pie=None, metrics=None)[source]¶
Query data in InfluxDB with aggregateWindow, pivoting the results to get metrics as columns.
- Parameters:
from_date (datetime) – Start datetime (ISO 8601 format: ‘YYYY-MM-DDTHH:MM:SSZ’).
to_date (datetime) – End datetime (ISO 8601 format: ‘YYYY-MM-DDTHH:MM:SSZ’).
window_size (str) – Aggregation window size (default: ‘20ms’).
qtok (str) – CodeID (required).
pie (str) – Left or Right foot (‘Right’, ‘Left’) (required).
metrics (list[str], optional) – List of metrics to query (default: predefined set).
- Returns:
DataFrame with metrics as columns, ordered by _time.
- Return type:
pd.DataFrame
- show_raw_sample(from_date, to_date, qtok, pie)[source]¶
Executes a sample query on InfluxDB to retrieve and print the first 5 records that match the specified filtering criteria.
This method is useful for debugging or quickly inspecting raw data from the database.
- Parameters:
from_date (datetime.datetime) – Start date of the query (inclusive).
to_date (datetime.datetime) – End date of the query (inclusive).
qtok (str) – The CodeID to filter the data by.
pie (str) – Indicates which foot’s data to query (“Left” or “Right”).
- Returns:
None. The results are printed directly to stdout.
- Return type:
None
The InfluxHelper class¶
- class InfluxDBms.influxdb_tools.InfluxHelper[source]¶
Bases:
objectHelper class for handling datetime parsing and default timestamp generation.