Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
inigoelv
Creator
Creator

Incremental Load

Good morning;

I ma making one incremental load where I insert new rows, updated rows and eliminate rows.

The problem is the base is not complete, because for saving espace in the server has one limitation of rows. It means the old ones are little by little being erased. 

I need maintain in the Completed Base the old ones.

The script used is:

Base:
LOAD * INLINE [
PrimaryKey, ART_CODICE, QUANTITA
2, B, 2
4, D, 4
6, E, 6
7, F, 7
];
concatenate
LOAD * INLINE [
PrimaryKey, ART_CODICE, QUANTITA
1, A, 1
2, B, 2
3, C, 3
4, D, 5
6, E, 6
] WHERE NOT Exists(PrimaryKey);
inner join
LOAD * INLINE [
PrimaryKey, ART_CODICE, QUANTITA
2, B, 2
4, D, 4
6, E, 6
7, F, 7
] where PrimaryKey>2;

In theory I expect:

PrimaryKeyART_CODICEQUANTITA
1A1
2B2
4D5
6E6
7F7

 

Thanks in advance

Labels (1)
1 Reply
rubenmarin

Hi, the last join does the 'delete' part, so if any value is not in this table it will be deleted.

You will need to obtain the lower primary key that the database has, do the "concatenate where not exists" and "join" codes with values higher or equal than this primary key, and add a step that adds all the values stored lower that the primary key.

Note that for rows with lower PrimeryKey than the one in database you can't control when it was deleted by an user or by the automatic deletion of database.