sqlapache-spark-sql

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.


Solution

  • maybe try:

    CREATE TABLE new_db.new_table AS
    SELECT *
    FROM old_db.old_table;