如何查看访问mariadb时spark生成的sql表达式?

a14dhokn  于 2021-07-09  发布在  Spark
关注(0)|答案(0)|浏览(140)

我尝试用以下代码将流写入rdms

def foreach_batch_function(df1, epoch_id):
    df1.write.format("jdbc") \
        .option("createTableColumnTypes", "cnt int, minBestLapTime double, trackName varchar(64), trackVersion varchar(64), carClass varchar(64), carName varchar(64), carVersion varchar(64)") \
        .option("url", "jdbc:mariadb://IPADDRESS") \
        .option("dbtable", "mydatabase.pysparktest") \
        .option("user", config["jdbc"]["user"]) \
        .option("password", config["jdbc"]["password"]) \
        .option("driver", "org.mariadb.jdbc.Driver") \
        .save()

得到以下错误

java.sql.SQLException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"cnt" int NOT NULL, "minBestLapTime" double , "trackName" varchar(64) , "trac...' at line 1

因为我在这里没有看到任何语法错误,所以我假设spark生成错误的sql。但怎么看呢?
我准备好了

log4j.properties:
log4j.rootCategory=DEBUG, console

但这没用

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题