Skip to content

Commit

Permalink
check credential before call spark.read.mltable()
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Li committed Dec 17, 2024
1 parent 4c0800a commit ec0e8a1
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ def read_mltable_in_spark(mltable_path: str):
"""Read mltable in spark."""
if mltable_path is None:
raise InvalidInputError("MLTable path is None.")
# validate if we can access the mltable, e.g. if env. is ready to access credential-less data
store_url = StoreUrl(mltable_path)
store_url.get_credential(True) # will raise exception if not able to access

spark = init_spark()
try:
return spark.read.mltable(mltable_path)
Expand Down

0 comments on commit ec0e8a1

Please sign in to comment.