Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/api/v1/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class SummaryRow(BaseModel):
Avg: Union[float, int, None]
Min: Union[float, int, None]
Max: Union[float, int, None]
Std: Union[float, int, None]
StDev: Union[float, int, None]
Sum: Union[float, int, None]
Var: Union[float, int, None]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ def _summary_query(parameters_dict: dict) -> str:
"CAST(Avg(`{{ value_column }}`) as decimal(10, 2)) as Avg, "
"CAST(Min(`{{ value_column }}`) as decimal(10, 2)) as Min, "
"CAST(Max(`{{ value_column }}`) as decimal(10, 2)) as Max, "
"CAST(stddev(`{{ value_column }}`) as decimal(10, 2)) as StdDev, "
"CAST(stddev(`{{ value_column }}`) as decimal(10, 2)) as StDev, "
"CAST(sum(`{{ value_column }}`) as decimal(10, 2)) as Sum, "
"CAST(variance(`{{ value_column }}`) as decimal(10, 2)) as Var FROM "
"{% if source is defined and source is not none %}"
Expand Down
2 changes: 1 addition & 1 deletion src/sdk/python/rtdip_sdk/queries/time_series/summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

def get(connection: object, parameters_dict: dict) -> pd.DataFrame:
"""
A function to return back a summary of statistics (Avg, Min, Max, Count, StdDev, Sum, Variance) by querying databricks SQL Warehouse using a connection specified by the user.
A function to return back a summary of statistics (Avg, Min, Max, Count, StDev, Sum, Variance) by querying databricks SQL Warehouse using a connection specified by the user.

The available connectors by RTDIP are Databricks SQL Connect, PYODBC SQL Connect, TURBODBC SQL Connect.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ def circular_standard_deviation(
Returns:
DataFrame: A dataframe containing the circular standard deviations
"""
circular_stddev_parameters = {
circular_stdev_parameters = {
"source": self.data_source,
"tag_names": tagname_filter,
"start_date": start_date,
Expand All @@ -488,7 +488,7 @@ def circular_standard_deviation(
}

return circular_standard_deviation.get(
self.connection, circular_stddev_parameters
self.connection, circular_stdev_parameters
)

def summary(
Expand Down
2 changes: 1 addition & 1 deletion tests/api/v1/test_api_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"Avg": [5.05],
"Min": [1.0],
"Max": [10.0],
"Std": [3.02],
"StDev": [3.02],
"Sum": [25.0],
"Var": [0.0],
}
Expand Down
4 changes: 2 additions & 2 deletions tests/sdk/python/rtdip_sdk/queries/test_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
ACCESS_TOKEN = "mock_databricks_token"
DATABRICKS_SQL_CONNECT = "databricks.sql.connect"
DATABRICKS_SQL_CONNECT_CURSOR = "databricks.sql.connect.cursor"
MOCKED_QUERY = 'SELECT `TagName`, count(`Value`) as Count, CAST(Avg(`Value`) as decimal(10, 2)) as Avg, CAST(Min(`Value`) as decimal(10, 2)) as Min, CAST(Max(`Value`) as decimal(10, 2)) as Max, CAST(stddev(`Value`) as decimal(10, 2)) as StdDev, CAST(sum(`Value`) as decimal(10, 2)) as Sum, CAST(variance(`Value`) as decimal(10, 2)) as Var FROM `mocked-buiness-unit`.`sensors`.`mocked-asset_mocked-data-security-level_events_mocked-data-type` WHERE `EventTime` BETWEEN to_timestamp("2011-01-01T00:00:00+00:00") AND to_timestamp("2011-01-02T23:59:59+00:00") AND `TagName` IN (\'MOCKED-TAGNAME\') GROUP BY `TagName` '
MOCKED_QUERY = 'SELECT `TagName`, count(`Value`) as Count, CAST(Avg(`Value`) as decimal(10, 2)) as Avg, CAST(Min(`Value`) as decimal(10, 2)) as Min, CAST(Max(`Value`) as decimal(10, 2)) as Max, CAST(stddev(`Value`) as decimal(10, 2)) as StDev, CAST(sum(`Value`) as decimal(10, 2)) as Sum, CAST(variance(`Value`) as decimal(10, 2)) as Var FROM `mocked-buiness-unit`.`sensors`.`mocked-asset_mocked-data-security-level_events_mocked-data-type` WHERE `EventTime` BETWEEN to_timestamp("2011-01-01T00:00:00+00:00") AND to_timestamp("2011-01-02T23:59:59+00:00") AND `TagName` IN (\'MOCKED-TAGNAME\') GROUP BY `TagName` '
MOCKED_QUERY_OFFSET_LIMIT = "LIMIT 10 OFFSET 10 "
MOCKED_PARAMETER_DICT = {
"business_unit": "mocked-buiness-unit",
Expand All @@ -53,7 +53,7 @@
"Avg": [5.5],
"Min": [1.0],
"Max": [10.0],
"Std": [3.2],
"StDev": [3.2],
"Sum": [25.0],
"var": [0.0],
}
Expand Down