-
Notifications
You must be signed in to change notification settings - Fork 9
import export
One of the common activities is to import and export different contents in a Viya Server. The viyacaddy package is make this job a little easier for a select set of data.
This cli is useful for:
-
Exporting selected VA reports as json files.
-
Importing Va reports stored as json files
-
Importing hdat, sas7bat, csv files into CAS
-
Importing .sas and .ds2 files into sashdat (for use with scoring actions)
-
Importing .astore and .sasast files into sashdat
You can install the cli as follows:
npm install -g @sassoftware/viyacaddy
- If you do not have nodejs installed on your system you can use
The cli can be run in interactive mode or in "batch" mode.
npx @sassoftware/viyacaddy --env <your-env-file>
You will get prompt to enter commands.
The env file has the following format
VIYA_SERVER=http://your-viya-server
CLIENTID=<a password client>
CLIENTSECRET=<a client secret>
Note that the default clientid sas.ec (no secret)can be used (consult your SAS Administrator).
npx @sassoftware/viyacaddy --env <your-env-file> -- file <cmdfile>
The env file is now augmented with an userid and password as follows:
VIYA_SERVER=http://your-viya-server
CLIENTID=<a password client>
CLIENTSECRET=<a client secret>
USER=username
PASSWORD=password
You can use a previously generated token instead of userid and password. Create a token and save it in some file (say mytoken) and modify the env file as follows
VIYA_SERVER=http://your-viya-server
CLIENTID=<a password client>
CLIENTSECRET=<a client secret>
TOKEN_FILE=mytoken
The cmdfile is a text file with a list of valid viyacaddy commands. These commands are executed in parallel.
When data or report is imported, the cli will delete any existing file and create the new one. Also the new data will not be loaded into memory. That task is left to the applications that will use the tables and reports that are imported.
- logon - to logon to Viya. This command will prompt for username and password
- exit - to exit the cli
- help - get help on commands
- caslibs -- lists the names of all caslibs
-
tables import -- to import hdat, b7dat,csv, astore, ds2 and sas files into cas tables in a caslib
tables import <input directory> <list of files|*> -c <caslib>
-
tables list -- to list the names of the tables in a specific caslib
tables list <caslib>
-
Import VA reports from specified directory into a SAS Viya folder
reports import <input directory> <list of names|*> -f <folder>
-
Export VA reports in json format to specified directory
reports export <list of reports> -d <directory-to-store-reports>
-
List reports in VA
reports list -- list the names of all the reports
- sasb7dat,sashdat,csv -- sashdat file
- astore -- sashdata file (schema: index , state)
- sas, ds2 -- sashdat - "model" table that can be executed with datastep.runCodeTable and ds2.runModel actions.(schema: modelName, dataStepsrc|ds2Src)
-
Import a.json and b.json from reportfiles directory into Public folder
- reports import ./reportfiles a.json b.json -f Public
-
Import all files from reportfiles directory into Public folder
- reports import ./reportfiles * -f Public
-
*Import files with spaces in name
- reports import ./reportfiles 'a report with spaces' -f Public
-
Export reports a and b as json files into the reportsfiles directory
- reports export a b -d ./reportfiles
-
List all the reports available to the user
- reports list
-
Import the two files from data directory into Public caslib
- tables import ./data iris.csv retails.sas7bdat -c Public
-
Import all the files in data directory into Public caslib
- tables import ./data * -c Public
-
List names of tables in the public caslib
- tables list public
Here is a sample command file
# import all report in the specificed directory
reports import c:/public/dev/reports * -f Public
# Import a sas program
tables import ../../data Cluster_SDOH6.sas -c public
# Import all data in a directory
tables import c:/public/dev/data * -c casuser
.... Under construction...
-
restaf
-
restaflib
-
Examples:
- Cas Server
- Compute Server
- Scoring with MAS
- Scoring with CAS
- Utility
-
CAS Related Functions
-
MAS Related Functions
-
Compute Server Related Functions
-
Reports Related Functions
-
Interactive CLI
-
Special Topic