Monday 16 March 2015

Reload vs Partial Reload

Suppose we've got a table like this:
Office:
LOAD * INLINE [
    EmployeeID, Name
    1, 100
    2, 200
    3, 300
    4, 400
    5, 500
    6, 600
];
Field EmployeeID looks like
Change a bit the script
Office:
LOAD * INLINE [
    EmployeeID, Name
    1, 100
    2, 200
    3, 300
    4, 400
    5, 500
    6, 600
];  

Office:
LOAD * INLINE [
 EmployeeID, Name
 6, 600
 7, 700
];
run again it (Ctrl+R) and take a look at EmployeeID field
we may see new seventh employee
But if we change a bit properties of EmployeeID field (Show Frequency)

we will see that the sixth employee presented twice
To avoid duplicating we need to check EmployeeID field like this:
Office:
LOAD * INLINE [
    EmployeeID, Name
    1, 100
    2, 200
    3, 300
    4, 400
    5, 500
    6, 600
];  

Office:
LOAD * INLINE [
 EmployeeID, Name
 6, 600
 7, 700
]
Where not Exists(EmployeeID);

It's a key moment.

Now change a script like this (ADD ONLY)
Office:
LOAD * INLINE [
    EmployeeID, Name
    1, 100
    2, 200
    3, 300
    4, 400
    5, 500
    6, 600
];  

Office:
ADD ONLY LOAD * INLINE [
 EmployeeID, Name
 6, 600
 7, 700
]

Where not Exists(EmployeeID);
and Run it(Ctrl+R). We see 
but if we Run Partial (Ctrl+Shift+R) we see 
At the and let's come back to previous script without ADD ONLY and Exists keywords
Office:
LOAD * INLINE [
    EmployeeID, Name
    1, 100
    2, 200
    3, 300
    4, 400
    5, 500
    6, 600
];  

Office:
ADD LOAD * INLINE [
 EmployeeID, Name
 6, 600
 7, 700
];
//Where not Exists(EmployeeID);

Every time we  Run Partial (Ctrl+Shift+R) we see that duplicates grow again

and again


Copyright © 2015 Ruslan Goncharov

No comments:

Post a Comment