Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Snowflake External Table : Add new column

I created a snowflake external table successfully and was able to load the data from s3. I want to add a column to this external table. In the Snowflake documentation they say that - "Alter an existing external table to add or remove columns using the following ALTER TABLE syntax: Add columns: ALTER TABLE … ADD COLUMN. Remove columns: ALTER TABLE … DROP COLUMN."

When I try adding a column to my external table, it gives me following error - "External table column TEST_COL must have a defining expression."

I am using following command to add the column - alter table EXTTABLE_TEST add column TEST_COL number;

Here is the link to Snowflake Documentation I am referring to - https://docs.snowflake.net/manuals/user-guide/tables-external-intro.html#adding-or-dropping-columns

Can someone please help me with this? Is it even possible to add/remove columns from external table. Any help is appreciated.

Thanks!

like image 954
Vineeta Singh Avatar asked Apr 24 '26 14:04

Vineeta Singh


1 Answers

Try this syntax instead for an external table:

alter table EXTTABLE_TEST add column TEST_COL number as (value:TEST_COL::number);

More Docs on External Tables and examples: https://docs.snowflake.net/manuals/sql-reference/sql/create-external-table.html#usage-notes

If this could be made clearer in the documentation, we welcome any Snowflake official documentation suggestions. Near the bottom of the documentation is an option to "report doc issue" which can also be used for feedback.

like image 86
Suzy Lockwood Avatar answered Apr 26 '26 16:04

Suzy Lockwood



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!