Query SQL Server with Azure Databricks - Azure Databricks | Microsoft Learn

PHOTO EMBED

Tue Oct 31 2023 14:50:20 GMT+0000 (Coordinated Universal Time)

Saved by @knguyencookie

remote_table = (spark.read
  .format("sqlserver")
  .option("host", "hostName")
  .option("port", "port") # optional, can use default port 1433 if omitted
  .option("user", "username")
  .option("password", "password")
  .option("database", "databaseName")
  .option("dbtable", "schemaName.tableName") # (if schemaName not provided, default to "dbo")
  .load()
)
content_copyCOPY

https://learn.microsoft.com/en-us/azure/databricks/external-data/sql-server