答案 0 :(得分:0)
@MichaelChau我建议在发表问题之前先做一些研究,如果您能证明您已经尝试解决问题的工作,人们往往会做出更好的回应。话虽这么说(对不起,这有点晚了),下面的代码应该可以回答您的问题:
%scala // sets the command language to scala, I'm testing this in a python notebook ?
import org.apache.spark.sql.DataFrame // this imports the DataFrame type
def writeToSQLWarehouse (df: DataFrame, tableName: String, mode: String) = {
// I didn't write out all the options, but this should give you a starting place
df.write
.option("dbTable", tableName)
.mode(mode)
.save()
}
我从databricks documentation page获得了此信息。如有其他疑问,请查看。