This is my code here.
df = spark.createDataFrame([[1,1,2]], schema=['id','first_name','last_name'])
(df.write.format("jdbc")
.option("url", <jdbc-url>)
.option("dbtable","hive_metastore.default.test")
.option("driver", "com.databricks.client.jdbc.Driver")
.mode("overwrite")
# .saveAsTable("test")
.save()
)
The Error
An error occurred while calling o273.save.
: java.sql.SQLException: [Databricks][JDBCDriver](500051) ERROR processing query/statement. Error Code: 0, SQL state: 42601,
Query: CREATE TAB***, Error message from Server: org.apache.hive.service.cli.HiveSQLException:
Error running query: [PARSE_SYNTAX_ERROR]
org.apache.spark.sql.catalyst.parser.ParseException:
[PARSE_SYNTAX_ERROR] Syntax error at or near '\"id\"'.(line 1, pos 19)
== SQL ==
CREATE TABLE test (\"id\" BIGINT , \"first_name\" BIGINT , \"last_name\" BIGINT )