spark-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Wenchen Fan <cloud0...@gmail.com>
Subject Re: How to persistent database/table created in sparkSession
Date Tue, 05 Dec 2017 13:12:51 GMT
Try with `SparkSession.builder().enableHiveSupport` ?

On Tue, Dec 5, 2017 at 3:22 PM, 163 <hewenting_ict@163.com> wrote:

> 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