Query Azure DB from Databricks
Tue Jul 23 2024 15:29:42 GMT+0000 (Coordinated Universal Time)
Saved by
@knguyencookie
#python
import sys
sys.path.append ('/Workspace/Users/khoa.nguyen@houstontexans.com/production_jobs/Data_Ops_Tools/')
from DataOpsMainFunctions import prod_azure_to_dbrix, prod_dbrix_to_azure , prodProperties
query_azure_db_df = spark.read.format("sqlserver")\
.option("host", "sqls-houstontexans-db-01.database.windows.net")\
.option("user", prodProperties['user']).option("password", prodProperties['password'])\
.option("database","sqls-houstontexans")\
.option("query", "SELECT * FROM reporting.db_data_catalogue WHERE table_schema='survey_monkey'")\
.option("fetchSize", 35000)\
.load()
query_azure_db_df.display()
content_copyCOPY
Comments