Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Lucas3594
Contributor
Contributor

Incremental load (insert)

Hi all,

 

I've been asked to set up an incremental update (insert only) from a SQL database. From what I can understand is that I need this:

1) I have an 'initial load' from my database straight to a QVD file for faster load times.

2) TheQVD file should be updated every day with only the latest data from the SQL database.

 

Here is the script I have so far thanks to the internet, the field 'd_transm' (=date) is the primary ID which I'll be using to base the date on.

 

MaxKeyLoad:
LOAD Max(d_transm) as MaxID
From [lib://QVD (bedcaqs01_qprofessionalsystems)/lucas.qvd] (qvd); 

Let vMaxID = peek('MaxID',MaxKeyLoad);


[historique]:
Load *;
SQL SELECT * FROM "Mephisto"."dbo"."historique" 
Where d_transm > '$(MaxID)';

Concatenate
LOAD * From [lib://QVD (bedcaqs01_qprofessionalsystems)/lucas.qvd] (qvd);

STORE [historique] into [lib://QVD (bedcaqs01_qprofessionalsystems)/lucas.qvd] (qvd);

Exit script;

 

The problem is that this script seems to load multiple times ALL the data from the SQL (millions of lines so this takes time), can someone help a newcomer with this ?

 

Thanks so much

 

 

 

Labels (3)
1 Reply
JordyWegman
Partner - Master
Partner - Master

Hi Lucas,

I think your variable vMaxID is probably going wrong. What does that one give you?

Jordy

Climber

Work smarter, not harder