Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have seen the word Resident in scripts and just wanted to know what it is and when would you use it? Has anyone got any examples that I could play wih?
Thanks Ivan
Hi Ivan,
The 'Resident' keyword simply indicates that the table that you're loading data from already exists in the loaded data model.
For example, let's say I've loaded a fact table containing data about each time someone logged into my website. I've called that table 'Logins'. If I wanted to create a summary within the script of the si logins table, I could do so using the resident keyword:
Logins_Recency:
LOAD
USER_ID,
date(MAX(LOGIN_DATE)) AS LAST_LOGIN_DATE,
IF(CEIL((today() - MAX(LOGIN_DATE))/30)>=24,24,CEIL((today() - MAX(LOGIN_DATE))/30)) AS LOGIN_RECENCY_SEGMENT
RESIDENT Logins
GROUP BY USER_ID;
Note that 'Resident' here referrs to the 'Logins' table which appears earlier in my script.
Hi Ivan,
The 'Resident' keyword simply indicates that the table that you're loading data from already exists in the loaded data model.
For example, let's say I've loaded a fact table containing data about each time someone logged into my website. I've called that table 'Logins'. If I wanted to create a summary within the script of the si logins table, I could do so using the resident keyword:
Logins_Recency:
LOAD
USER_ID,
date(MAX(LOGIN_DATE)) AS LAST_LOGIN_DATE,
IF(CEIL((today() - MAX(LOGIN_DATE))/30)>=24,24,CEIL((today() - MAX(LOGIN_DATE))/30)) AS LOGIN_RECENCY_SEGMENT
RESIDENT Logins
GROUP BY USER_ID;
Note that 'Resident' here referrs to the 'Logins' table which appears earlier in my script.