Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to copy table by spark-sql

Actually, I want to move one table to another database. But spark don't permit this.

Then, how to copy table by spark-sql?

I already tried this.

SELECT *
INTO table1 IN new_database
FROM old_database.table1

But it was not working.

like image 403
hyeon Avatar asked May 08 '17 12:05

hyeon


1 Answers

maybe try:

CREATE TABLE new_db.new_table AS
SELECT *
FROM old_db.old_table;
like image 109
David Schuler Avatar answered Oct 02 '22 21:10

David Schuler