0

Is it possible to transfer a table from one schema to another schema in Spark Delta Lake just like ALTER SCHEMA new_schema_name TRANSFER old_schema_name.table_name in SQL Server without having to drop and create table again?

I am using Spark Delta Lake in my local machine.

user4157124
  • 2,809
  • 13
  • 27
  • 42
Merin Nakarmi
  • 3,148
  • 3
  • 35
  • 42
  • Can you please post a sample dataset and the operation you're trying to perform? Think that will help others. – Powers Sep 28 '22 at 04:08

1 Answers1

0

There are certain schema change operations you can perform without having to drop and create the table again (e.g. when column mapping is enabled, you can drop, reorder, and rename columns via metadata operations).

Here's an example of how to drop a column:

ALTER TABLE `my_cool_table` DROP COLUMN language

Other operations will require a rewrite of the data, it depends.

Powers
  • 18,150
  • 10
  • 103
  • 108
  • Could you give me a syntax to change Schema (Namespace or Database) of a table instead of dropping a column please, if you have done it before. – Merin Nakarmi Nov 16 '22 at 19:41