-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Weather Query Improvement with Forecast Runtime Query (#621)
* Simplify Table Name Signed-off-by: Amber-Rigg <amber.l.rigg25@gmail.com> * RAW query on Forecast Run Time Signed-off-by: Amber-Rigg <amber.l.rigg25@gmail.com> * Update Tests Signed-off-by: Amber-Rigg <amber.l.rigg25@gmail.com> * Update tests Signed-off-by: Amber-Rigg <amber.l.rigg25@gmail.com> * Update Tests Signed-off-by: Amber-Rigg <amber.l.rigg25@gmail.com> * Update Tests Signed-off-by: Amber-Rigg <amber.l.rigg25@gmail.com> * Refactor raw_parameters build Signed-off-by: Amber-Rigg <amber.l.rigg25@gmail.com> * Update Query Builder Table Connection Signed-off-by: Amber-Rigg <amber.l.rigg25@gmail.com> * Review to include options and refactor test Signed-off-by: Amber-Rigg <amber.l.rigg25@gmail.com> * black formatting Signed-off-by: Amber-Rigg <amber.l.rigg25@gmail.com> * Remove 'source' parameter from WeatherQueryBuilder methods Signed-off-by: Amber-Rigg <amber.l.rigg25@gmail.com> * Examples Added to Documentation Signed-off-by: Amber-Rigg <amber.l.rigg25@gmail.com> * Remove duplication in tests Signed-off-by: Amber-Rigg <amber.l.rigg25@gmail.com> * Remove unused Variables and include timestamp coulmn name default Signed-off-by: Amber-Rigg <amber.l.rigg25@gmail.com> * Documentation and Examples Formatting Signed-off-by: Amber-Rigg <amber.l.rigg25@gmail.com> * Documentation Update Signed-off-by: Amber-Rigg <amber.l.rigg25@gmail.com> --------- Signed-off-by: Amber-Rigg <amber.l.rigg25@gmail.com>
- Loading branch information
1 parent
d635f22
commit f769833
Showing
10 changed files
with
562 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,61 @@ | ||
# Weather Latest Function | ||
::: src.sdk.python.rtdip_sdk.queries.weather.latest | ||
::: src.sdk.python.rtdip_sdk.queries.weather.latest | ||
|
||
## Example get_point | ||
|
||
```python | ||
from rtdip_sdk.authentication.azure import DefaultAuth | ||
from rtdip_sdk.queries.weather.latest import get_point | ||
from rtdip_sdk.connectors import DatabricksSQLConnection | ||
|
||
auth = DefaultAuth().authenticate() | ||
token = auth.get_token("2ff814a6-3304-4ab8-85cb-cd0e6f879c1d/.default").token | ||
connection = DatabricksSQLConnection("{server_hostname}", "{http_path}", token) | ||
|
||
params = { | ||
"forecast": "mock_forecast", | ||
"forecast_type": "mock_weather", | ||
"region": "mock_region", | ||
"data_security_level": "mock_security", | ||
"data_type": "mock_data_type", | ||
"lat": 1.1, | ||
"lon": 1.1, | ||
} | ||
|
||
x = get_point(connection, params) | ||
|
||
print(x) | ||
``` | ||
|
||
## Example get_grid | ||
|
||
```python | ||
from rtdip_sdk.authentication.azure import DefaultAuth | ||
from rtdip_sdk.queries.weather.latest import get_point | ||
from rtdip_sdk.connectors import DatabricksSQLConnection | ||
|
||
auth = DefaultAuth().authenticate() | ||
token = auth.get_token("2ff814a6-3304-4ab8-85cb-cd0e6f879c1d/.default").token | ||
connection = DatabricksSQLConnection("{server_hostname}", "{http_path}", token) | ||
|
||
params = { | ||
"forecast": "mock_forecast", | ||
"forecast_type": "mock_weather", | ||
"region": "mock_region", | ||
"data_security_level": "mock_security", | ||
"data_type": "mock_data_type", | ||
"min_lat": 36, | ||
"max_lat": 38, | ||
"min_lon": -109.1, | ||
"max_lon": -107.1, | ||
} | ||
|
||
x = get_grid(connection, params) | ||
|
||
print(x) | ||
``` | ||
|
||
These examples are using [```DefaultAuth()```](../../../authentication/azure.md) and [```DatabricksSQLConnection()```](../../connectors/db-sql-connector.md) to authenticate and connect. You can find other ways to authenticate [here](../../../authentication/azure.md). The alternative built in connection methods are either by [```PYODBCSQLConnection()```](../../connectors/pyodbc-sql-connector.md), [```TURBODBCSQLConnection()```](../../connectors/turbodbc-sql-connector.md) or [```SparkConnection()```](../../connectors/spark-connector.md). | ||
|
||
!!! note "Note" | ||
</b>```server_hostname``` and ```http_path``` can be found on the [SQL Warehouses Page](../../../../queries/databricks/sql-warehouses.md). <br /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,73 @@ | ||
# Weather Raw Function | ||
::: src.sdk.python.rtdip_sdk.queries.weather.raw | ||
::: src.sdk.python.rtdip_sdk.queries.weather.raw | ||
|
||
## Example get_point | ||
|
||
```python | ||
from rtdip_sdk.authentication.azure import DefaultAuth | ||
from rtdip_sdk.queries.weather.raw import get_point | ||
from rtdip_sdk.connectors import DatabricksSQLConnection | ||
|
||
auth = DefaultAuth().authenticate() | ||
token = auth.get_token("2ff814a6-3304-4ab8-85cb-cd0e6f879c1d/.default").token | ||
connection = DatabricksSQLConnection("{server_hostname}", "{http_path}", token) | ||
|
||
params = { | ||
"forecast": "mock_forecast", | ||
"forecast_type": "mock_weather", | ||
"region": "mock_region", | ||
"data_security_level": "mock_security", | ||
"data_type": "mock_data_type", | ||
"lat": 1.1, | ||
"lon": 1.1, | ||
"start_date": "2020-01-01", | ||
"end_date": "2020-01-02", | ||
"forecast_run_start_date": "2020-01-01", | ||
"forecast_run_end_date": "2020-01-02", | ||
"timestamp_column": "EventTime", | ||
"forecast_run_timestamp_column": "EnqueuedTime", | ||
} | ||
|
||
x = get_point(connection, params) | ||
|
||
print(x) | ||
``` | ||
|
||
## Example get_grid | ||
|
||
```python | ||
from rtdip_sdk.authentication.azure import DefaultAuth | ||
from rtdip_sdk.queries.weather.raw import get_grid | ||
from rtdip_sdk.connectors import DatabricksSQLConnection | ||
|
||
auth = DefaultAuth().authenticate() | ||
token = auth.get_token("2ff814a6-3304-4ab8-85cb-cd0e6f879c1d/.default").token | ||
connection = DatabricksSQLConnection("{server_hostname}", "{http_path}", token) | ||
|
||
params = { | ||
"forecast": "mock_forecast", | ||
"forecast_type": "mock_weather", | ||
"region": "mock_region", | ||
"data_security_level": "mock_security", | ||
"data_type": "mock_data_type", | ||
"min_lat": 36, | ||
"max_lat": 38, | ||
"min_lon": -109.1, | ||
"max_lon": -107.1, | ||
"start_date": "2020-01-01", | ||
"end_date": "2020-01-02", | ||
"forecast_run_start_date": "2020-01-01", | ||
"forecast_run_end_date": "2020-01-02", | ||
"timestamp_column": "EventTime", | ||
"forecast_run_timestamp_column": "EnqueuedTime", | ||
} | ||
|
||
x = get_grid(connection, params) | ||
|
||
print(x) | ||
``` | ||
|
||
These examples are using [```DefaultAuth()```](../../../authentication/azure.md) and [```DatabricksSQLConnection()```](../../connectors/db-sql-connector.md) to authenticate and connect. You can find other ways to authenticate [here](../../../authentication/azure.md). The alternative built in connection methods are either by [```PYODBCSQLConnection()```](../../connectors/pyodbc-sql-connector.md), [```TURBODBCSQLConnection()```](../../connectors/turbodbc-sql-connector.md) or [```SparkConnection()```](../../connectors/spark-connector.md). | ||
|
||
!!! note "Note" | ||
</b>```server_hostname``` and ```http_path``` can be found on the [SQL Warehouses Page](../../../../queries/databricks/sql-warehouses.md). <br /> |
8 changes: 7 additions & 1 deletion
8
docs/sdk/code-reference/query/functions/weather/weather_query_builder.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
# Weather Query Builder | ||
::: src.sdk.python.rtdip_sdk.queries.weather.weather_query_builder | ||
::: src.sdk.python.rtdip_sdk.queries.weather.weather_query_builder | ||
|
||
!!! note "Note" | ||
</b>These examples are using [```DefaultAuth()```](../../../authentication/azure.md) and [```DatabricksSQLConnection()```](../../connectors/db-sql-connector.md) to authenticate and connect. You can find other ways to authenticate [here](../../../authentication/azure.md). The alternative built in connection methods are either by [```PYODBCSQLConnection()```](../../connectors/pyodbc-sql-connector.md), [```TURBODBCSQLConnection()```](../../connectors/turbodbc-sql-connector.md) or [```SparkConnection()```](../../connectors/spark-connector.md).<br /> | ||
|
||
!!! note "Note" | ||
</b>```server_hostname``` and ```http_path``` can be found on the [SQL Warehouses Page](../../../../queries/databricks/sql-warehouses.md). <br /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.