Spark How can i create temp views in user defined database instead of default database

0 votes

In spark SQL when I create temp views they get stored in default database.

It seems I can create a user-defined database as well

spark.sql("create database test")

How can I create temp views in the user-defined database instead of the default database, in above for example in "test" database?

Also, when I create a temp view and run command

spark.sql("show tables in default")

it lists all the tables in the database, here I see a column "isTemporary" is set to True. What is the significance of this column, and how can, for a particular view I can set it to "False" and if I do so, will this table be permanently stored in Spark?

Jul 14, 2019 in Apache Spark by Ashul
4,110 views

1 answer to this question.

0 votes

You can try the below code:

df.registerTempTable(“airports”)

sqlContext.sql(" create database New ")

sqlContext.sql(" use New ")

sqlContext.sql(" create table new123 as select * from airports")
answered Jul 14, 2019 by Ishan

Related Questions In Apache Spark

0 votes
2 answers

In a Spark DataFrame how can I flatten the struct?

// Collect data from input avro file ...READ MORE

answered Jul 4, 2019 in Apache Spark by Dhara dhruve
5,678 views
+1 vote
1 answer

How can I write a text file in HDFS not from an RDD, in Spark program?

Yes, you can go ahead and write ...READ MORE

answered May 29, 2018 in Apache Spark by Shubham
• 13,490 points
7,906 views
0 votes
1 answer

How can I compare the elements of the RDD using MapReduce?

You have to use the comparison operator ...READ MORE

answered May 24, 2018 in Apache Spark by Shubham
• 13,490 points
3,148 views
+1 vote
2 answers
+1 vote
1 answer

Hadoop Mapreduce word count Program

Firstly you need to understand the concept ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 11,380 points
10,559 views
0 votes
1 answer

hadoop.mapred vs hadoop.mapreduce?

org.apache.hadoop.mapred is the Old API  org.apache.hadoop.mapreduce is the ...READ MORE

answered Mar 16, 2018 in Data Analytics by nitinrawat895
• 11,380 points
2,185 views
+2 votes
11 answers

hadoop fs -put command?

Hi, You can create one directory in HDFS ...READ MORE

answered Mar 16, 2018 in Big Data Hadoop by nitinrawat895
• 11,380 points
104,216 views
0 votes
1 answer

Difference between cogroup and full outer join in spark

Please go through the below explanation : Full ...READ MORE

answered Jul 14, 2019 in Apache Spark by Kiran
9,374 views
0 votes
1 answer
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP