Created a sample Dataframe with string data and trying to write that row into the google spanner table which is already created in the database(Google SQL dialect Spanner DB)
Trying to write as below:
data.write.format("jdbc")
.option("url", jdbcUrl)
.option("driver", "com.google.cloud.spanner.jdbc.JdbcDriver")
.option("dbtable", tableName)
.mode("append")
.save()
sample Dataframe(data) schema:
root
11:42:27 |-- sampleNumber: string (nullable = true)
Error:
Caused by: repackaged.com.google.google.cloud.spanner.SpannerBatchUpdateException: Syntax error: Unexpected string literal \"sampleNumber\" [at 1:37]\nINSERT INTO Account (\"sampleNumber\") VALUES (@p1)\n ^
at repackaged.com.google.google.cloud.spanner.jdbc.JdbcSqlExceptionFactory.batchException(JdbcSqlExceptionFactory.java:325)
Table Schema:
11:42:27 |-- sampleNumber: string (nullable = true)
Tried with different df schema and types but still could not pass through that error