I have to insert records into Redshift table on a periodic basis. So I chose the strategy where I will copy s3 data into stage table and then append the stage table data into actual table using alter append command. In my case.
Stage table - URL_DATA_TEMP
Actual Table - URL_METADATA
now both tables I created using the same command and only changing the table name. ex:
CREATE TABLE _360_model.URL_METADATA
(
URL VARCHAR(8000),
URL_MD5 VARCHAR(300),
INDEX VARCHAR(200),
ASSET_TYPE VARCHAR(200)
);
CREATE TABLE _360_model.URL_DATA_TEMP
(
URL VARCHAR(8000),
URL_MD5 VARCHAR(300),
INDEX VARCHAR(200),
ASSET_TYPE VARCHAR(200)
);
Still when I try to use following append command, it complains.
alter table _360_model.URL_METADATA append from _360_model.URL_DATA_TEMP;
error: Columns don't match.
code: 8001
context: Column "asset_type" has different attributes in the source table
and the target table. Columns with the same name must have the same
attributes in both tables.
I am not able to understand when I used almost same command to create table, how can column structure can be different.