-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add sql credential pass through doc (#883)
* add sql credential pass through doc Signed-off-by: Yuqing Wei <[email protected]> * fix comments Signed-off-by: Yuqing Wei <[email protected]> * fix comments Signed-off-by: Yuqing Wei <[email protected]> Signed-off-by: Yuqing Wei <[email protected]>
- Loading branch information
1 parent
4efb683
commit f8a7e76
Showing
3 changed files
with
76 additions
and
1 deletion.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -245,6 +245,45 @@ def test_feathr_get_offline_features_to_sql(): | |
# assuming the job can successfully run; otherwise it will throw exception | ||
client.wait_job_to_finish(timeout_sec=Constants.SPARK_JOB_TIMEOUT_SECONDS) | ||
|
||
@pytest.mark.skip(reason="Marked as skipped as we need to setup token and enable SQL AAD login for this test") | ||
def test_feathr_get_offline_features_to_sql_with_token(): | ||
""" | ||
Test get_offline_features() can save data to SQL. | ||
""" | ||
# runner.invoke(init, []) | ||
test_workspace_dir = Path( | ||
__file__).parent.resolve() / "test_user_workspace" | ||
client: FeathrClient = basic_test_setup(os.path.join(test_workspace_dir, "feathr_config.yaml")) | ||
|
||
location_id = TypedKey(key_column="DOLocationID", | ||
key_column_type=ValueType.INT32, | ||
description="location id in NYC", | ||
full_name="nyc_taxi.location_id") | ||
|
||
feature_query = FeatureQuery( | ||
feature_list=["f_location_avg_fare"], key=location_id) | ||
settings = ObservationSettings( | ||
observation_path="wasbs://[email protected]/sample_data/green_tripdata_2020-04.csv", | ||
event_timestamp_column="lpep_dropoff_datetime", | ||
timestamp_format="yyyy-MM-dd HH:mm:ss") | ||
|
||
now = datetime.now() | ||
|
||
# Set DB token before submitting job | ||
# os.environ[f"SQL1_TOKEN"] = "some_token" | ||
os.environ["SQL1_TOKEN"] = client.credential.get_token("https://management.azure.com/.default").token | ||
output_path = JdbcSink(name="sql1", | ||
url="jdbc:sqlserver://feathrazureci.database.windows.net:1433;database=feathrci;encrypt=true;", | ||
dbtable=f'feathr_ci_sql_token_{str(now)[:19].replace(" ", "_").replace(":", "_").replace("-", "_")}', | ||
auth="TOKEN") | ||
|
||
client.get_offline_features(observation_settings=settings, | ||
feature_query=feature_query, | ||
output_path=output_path) | ||
|
||
# assuming the job can successfully run; otherwise it will throw exception | ||
client.wait_job_to_finish(timeout_sec=Constants.SPARK_JOB_TIMEOUT_SECONDS) | ||
|
||
def test_feathr_materialize_to_cosmosdb(): | ||
""" | ||
Test FeathrClient() CosmosDbSink. | ||
|