spark-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 163 <hewenting_...@163.com>
Subject How to persistent database/table created in sparkSession
Date Tue, 05 Dec 2017 07:22:15 GMT
Hi, 
    How can I persistent database/table created in spark application?

object TestPersistentDB {
        def main(args:Array[String]): Unit = {
                val spark = SparkSession.builder()
                        .appName("Create persistent table")
                        .config("spark.master”,"local")
                        .getOrCreate()
                import spark.implicits._
                spark.sql("create database testdb location \"hdfs://node1:8020/testdb\")

        }
}

  When I use spark.sql(“create database”) in sparkSession, and close this sparkSession.

  The created database is not persisted to metadata, So I cannot find it in spark-sql: show
databases.



regards
wendy
Mime
View raw message