I'm having issues with auto increment and sequences in Snowflake because of Talend.
I have a job where I constantly drop a table and recreate it. When using auto increment, the ID is never reset, so after 10 imports I'm already at ID 48724, whereas with sequence, I could reset my ID whenever I drop the table.
Unfortunately I cannot reset an auto increment value in Snowflake. I also read that it was better practice to use sequences.
Here's my sequence and my table.
CREATE OR REPLACE sequence dimsysteminterface_id_seq start = 1 increment = 1;
DROP TABLE DIMSYSTEMINTERFACE
CREATE TABLE IF NOT EXISTS dimsysteminterface (
id INTEGER DEFAULT dimsysteminterface_seq.NEXTVAL NOT NULL PRIMARY KEY,
systeminterfaceid bigint,
definitionkey character varying(60),
name character varying(80),
defname character varying(80),
servicename character varying(255),
systemmanufacturer character varying(80),
systemname character varying(30),
systemversion character varying(15),
systemdeftype character varying(30),
status character varying(15),
scd_start timestamp without time zone,
scd_end timestamp without time zone,
scd_version integer,
scd_active boolean
);
Here's my job:
Here's my tMAP:
Here's the actual output in my database:
What I'm trying to do is to call my sequence and get the next value for each new record like once I run my job. Same behavior as SELECT dimsysteminterface_seq.NEXTVAL;
It works perfectly with a Postgres database, since I can define something like this in the tdbOutput's advanced settings:
In snowflake, I can't.
How to achieve that? I also added Snowflake as tag, maybe I'm not seeing something. Thank you!



