feat: adding demo data job
This commit is contained in:
@@ -1,7 +1,14 @@
|
||||
/**
|
||||
@file
|
||||
@brief Creates demo tables and associated config
|
||||
@details Will self-destruct. Can be removed in prod installs.
|
||||
@details Can be removed in prod installs.
|
||||
|
||||
To activate this job, set dcdemoflag=1
|
||||
|
||||
Note that this will:
|
||||
* REPLACE any tables named CARS_EXT or COUNTRIES in the PUBLIC library
|
||||
* REPLACE all DC config for libraries named PUBLIC
|
||||
* CREATE a folder called "demo" in the DC Apploc
|
||||
|
||||
<h4> SAS Macros </h4>
|
||||
@li mpeinit.sas
|
||||
@@ -16,22 +23,35 @@
|
||||
|
||||
**/
|
||||
|
||||
/* this library will need to be manually added to the autoexec or settings */
|
||||
|
||||
|
||||
%let dcdemoflag=1;
|
||||
%let demolib=PUBLIC;
|
||||
|
||||
|
||||
%mpeinit()
|
||||
|
||||
options dlcreatedir;
|
||||
libname &demolib "%sysfunc(pathname(&dc_libref))/public";
|
||||
|
||||
%mp_abort(iftrue= (&syscc ne 0)
|
||||
/* to enable - delete here */
|
||||
%let dcdemoflag=0;
|
||||
libname &demolib "%sysfunc(pathname(&dc_libref))/&demolib";
|
||||
|
||||
|
||||
%mp_abort(iftrue= (&dcdemoflag ne 1)
|
||||
,mac=&_program
|
||||
,msg=%str(Problem during &demolib assignment (&syswarningtext &syserrortext))
|
||||
,msg=%str(Job not configured. See comments in the code.)
|
||||
)
|
||||
|
||||
%mpeinit()
|
||||
options replace;
|
||||
data &demolib..cars_ext(index=(carspk=(make model PRODUCTIONDATE) /unique));
|
||||
|
||||
data &demolib..cars_ext
|
||||
%let engine_type=%mf_getengine(&base_lib);
|
||||
%if &engine_type=CAS %then %do;
|
||||
(promote=yes)
|
||||
%end;
|
||||
%else %do;
|
||||
(index=(carspk=(make model PRODUCTIONDATE) /unique))
|
||||
%end;
|
||||
;
|
||||
|
||||
attrib
|
||||
MAKE length= $13
|
||||
MODEL length= $40
|
||||
@@ -69,8 +89,14 @@ data &demolib..cars_ext(index=(carspk=(make model PRODUCTIONDATE) /unique));
|
||||
*put (_all_)(=);
|
||||
run;
|
||||
|
||||
|
||||
data &demolib..COUNTRIES (index=(countriespk=(origin country) /unique));
|
||||
data &demolib..COUNTRIES
|
||||
%if &engine_type=CAS %then %do;
|
||||
(promote=yes)
|
||||
%end;
|
||||
%else %do;
|
||||
(index=(countriespk=(origin country) /unique))
|
||||
%end;
|
||||
;
|
||||
attrib
|
||||
ORIGIN length= $6
|
||||
COUNTRY length= $30
|
||||
@@ -167,6 +193,15 @@ insert into &dc_libref..MPE_VALIDATIONS set
|
||||
,rule_value="SASHELP.CARS.TYPE"
|
||||
,rule_active=1
|
||||
,tx_to='31DEC5999:23:59:59'dt;
|
||||
insert into &dc_libref..MPE_VALIDATIONS set
|
||||
tx_from=0
|
||||
,base_lib="&demolib"
|
||||
,base_ds="CARS_EXT"
|
||||
,base_col="POTENTIALBUY"
|
||||
,rule_type='SOFTSELECT'
|
||||
,rule_value="&demolib..CARS_EXT.POTENTIALBUY"
|
||||
,rule_active=1
|
||||
,tx_to='31DEC5999:23:59:59'dt;
|
||||
%mp_abort(iftrue= (&syscc ne 0)
|
||||
,mac=&_program
|
||||
,msg=%str(syscc=syscc=&syscc during param configuration)
|
||||
|
||||
Reference in New Issue
Block a user