<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic SQL Alter table command not working for me in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/sql-alter-table-command-not-working-for-me/m-p/16344#M10538</link>
    <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;I am a novice with databricks. I am performing some independent learning. I am trying to add a column to an existing table. Here is my syntax:&lt;/P&gt;
&lt;P&gt;%sql &lt;/P&gt;
&lt;P&gt;ALTER TABLE car_parts ADD COLUMNS (engine_present boolean)&lt;/P&gt;
&lt;P&gt;which returns the error:&lt;/P&gt;SyntaxError: invalid syntax File "&amp;lt;command-3097619422049343&amp;gt;", line 4 ALTER TABLE car_parts ADD COLUMNS (engine_present boolean) 
&lt;P&gt;&lt;/P&gt;

 In general I am having issues executing raw sql commands from these execution windows (cells) in my databricks community edition tool.


 I have also tried:


 sqlContext.sql("ALTER TABLE car_parts ADD engine_present boolean")
 &lt;P&gt;&lt;/P&gt;


 , which returns the error:
ParseException: no viable alternative at input 'ALTER TABLE car_parts ADD engine_present' (line 1, pos 31)
&lt;P&gt;&lt;/P&gt;I am certain the table is present as:
&lt;P&gt;sqlContext.sql("SELECT * FROM car_parts")&lt;/P&gt;works fine. I would grateful for any insights. Thank you. 
&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 17 Aug 2021 18:32:29 GMT</pubDate>
    <dc:creator>TimothyClotwort</dc:creator>
    <dc:date>2021-08-17T18:32:29Z</dc:date>
    <item>
      <title>SQL Alter table command not working for me</title>
      <link>https://community.databricks.com/t5/data-engineering/sql-alter-table-command-not-working-for-me/m-p/16344#M10538</link>
      <description>&lt;P&gt;&lt;/P&gt;
&lt;P&gt;I am a novice with databricks. I am performing some independent learning. I am trying to add a column to an existing table. Here is my syntax:&lt;/P&gt;
&lt;P&gt;%sql &lt;/P&gt;
&lt;P&gt;ALTER TABLE car_parts ADD COLUMNS (engine_present boolean)&lt;/P&gt;
&lt;P&gt;which returns the error:&lt;/P&gt;SyntaxError: invalid syntax File "&amp;lt;command-3097619422049343&amp;gt;", line 4 ALTER TABLE car_parts ADD COLUMNS (engine_present boolean) 
&lt;P&gt;&lt;/P&gt;

 In general I am having issues executing raw sql commands from these execution windows (cells) in my databricks community edition tool.


 I have also tried:


 sqlContext.sql("ALTER TABLE car_parts ADD engine_present boolean")
 &lt;P&gt;&lt;/P&gt;


 , which returns the error:
ParseException: no viable alternative at input 'ALTER TABLE car_parts ADD engine_present' (line 1, pos 31)
&lt;P&gt;&lt;/P&gt;I am certain the table is present as:
&lt;P&gt;sqlContext.sql("SELECT * FROM car_parts")&lt;/P&gt;works fine. I would grateful for any insights. Thank you. 
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Aug 2021 18:32:29 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sql-alter-table-command-not-working-for-me/m-p/16344#M10538</guid>
      <dc:creator>TimothyClotwort</dc:creator>
      <dc:date>2021-08-17T18:32:29Z</dc:date>
    </item>
    <item>
      <title>Re: SQL Alter table command not working for me</title>
      <link>https://community.databricks.com/t5/data-engineering/sql-alter-table-command-not-working-for-me/m-p/16345#M10539</link>
      <description>&lt;P&gt;Is the table you are working with in the Delta format? The table commands (i.e. Alter) do not work for all storage formats. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example if I run the following commands then I can alter a table. Note - there is no data in the table but the table exists and I can alter the table.  &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;create table if not exists add_col_test  (
col_one integer, 
col_two integer
)
USING DELTA 
; 
&amp;nbsp;
describe add_col_test; 
&amp;nbsp;
alter table add_col_test ADD columns (col_three boolean);
&amp;nbsp;
describe add_col_test; &lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Sep 2021 21:07:06 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/sql-alter-table-command-not-working-for-me/m-p/16345#M10539</guid>
      <dc:creator>Ryan_Chynoweth</dc:creator>
      <dc:date>2021-09-01T21:07:06Z</dc:date>
    </item>
  </channel>
</rss>

