Last active
January 16, 2022 23:14
-
-
Save RachidAZ/99f704c67ea408aa479a26a79b72d602 to your computer and use it in GitHub Desktop.
PySpark use Python variable in SQL command
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
# set the varilable in python | |
filePath='abfss://{container_name}@{storage_account_name}.dfs.core.windows.net/curated/Dims/Dim_X/*.csv' | |
spark.conf.set('f.filePath',filePath) | |
# use the varilable in SQL command | |
%sql | |
CREATE OR REPLACE TEMPORARY VIEW V_SomeView | |
USING CSV | |
OPTIONS (path '${f.filePath}', header "true", mode "FAILFAST") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment