Reputation: 1923
I have a file that contains id column (which is the PK in the table I'm trying to load to) and a start and end date column. Even if the file is empty and contains no id, we append a start and end date to the file.
So when I try to load the s3 file to snowflake I see:
NULL result in a non-nullable column
I've also run an alter statement on the table to drop the primary keys but I still see this error
The file I'm trying to load to snowflake:
id | start_date | end_date |
---|---|---|
2022-01-01 | 2022-01-02 |
The command I'm using to load to snowflake from s3:
COPY INTO my_table
FROM (
SELECT id, start_date, end_date
FROM @s3_location/ids.csv
)
file_format = (format_name = 'file format')
TRUNCATECOLUMNS = FALSE
FORCE = FALSE
Upvotes: 0
Views: 452
Reputation: 156748
It sounds like you want to allow your ID column to be null.
ALTER TABLE my_table ALTER COLUMN id DROP NOT NULL;
If that's true, you'll also want to stop treating it as a primary key.
ALTER TABLE my_table DROP PRIMARY KEY;
Upvotes: 1