I use pyspark 2.4.4 when I am getting the data from SQL Server I get com.microsoft.sqlserver.jdbc.SQLServerException: The "variant" data type is not supported.
What is needed to do? to fix this problem. I read this. But, I do not understand.
EDIT: The following is the code I use to create the error message:
for i in df['name']: mssql_df = spark.read.format("jdbc") \
.option("url", "jdbc:sqlserver://SERVERNAME:1433;databaseName=DB;integratedSecurity=true") \
.option("dbtable", "[" + i + "]") \
.option("driver", 'com.microsoft.sqlserver.jdbc.SQLServerDriver').load()
This answer comes a bit late but might be of help to future searches for solution of that error. I simply upgraded my connector from version 6.1.0.jre8 to 8.1.0.jre8-preview and the error was resolved.
You can check for latest version in Maven Repository.
https://mvnrepository.com/artifact/com.microsoft.sqlserver/mssql-jdbc mssql-jdbc from version 6.3.x up to current all support "variant" data type. You just update dependency to resolve your problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With