Skip to content

使用LakeSoulTable.upsert()时不管创不创建表都提示表不存在 #131

Answered by moresun
yzb1234 asked this question in Q&A
Discussion options

You must be logged in to vote
 sql(
      s"""
         |CREATE TABLE lakesoul_test(a LONG NOT NULL, b String)
         |USING lakesoul
         |OPTIONS('path'='${dir.getCanonicalPath}')""".stripMargin)

需要指定path,表会在指定path中存储数据,是不是漏掉了

    Seq((1, "a"), (2, "insert")).toDF("id", "change_kind")
      .write
      .mode("overwrite")
      .format("lakesoul")
      .option("lakesoul_cdc_change_column", "change_kind")
      .save(path)

也可以使用dataframe这种方式建表
代码案例可以参考如下case
https://github.com/meta-soul/LakeSoul/blob/main/lakesoul-spark/src/test/scala/org/apache/spark/sql/lakesoul/DDLSuite.scala

https://github.com/meta-soul/LakeSoul/blob/main/lakesoul-spark/src/test/scala/org/apache/spark/sql/lakesoul/TableCreationTests.scala

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by dmetasoul01
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #89 on January 05, 2023 03:00.