SAS Viya. Kevin D. Smith

Чтение книги онлайн.

Читать онлайн книгу SAS Viya - Kevin D. Smith страница 7

Автор:
Жанр:
Серия:
Издательство:
SAS Viya - Kevin D. Smith

Скачать книгу

[2]: conn = swat.CAS('server-name.mycompany.com', 5570,

       ...: 'username', 'password')

      When you connect to CAS, it creates a session on the server. By default, all resources (CAS actions, data tables, options, and so on) are available only to that session. Some resources can be promoted to a global scope, which we discuss later in the book.

      To see what CAS actions are available, use the help method on the CAS connection object, which calls the help action on the CAS server.

      In [3]: out = conn.help()

      NOTE: Available Action Sets and Actions:

      NOTE: accessControl

      NOTE: assumeRole - Assumes a role

      NOTE: dropRole - Relinquishes a role

      NOTE: showRolesIn - Shows the currently active role

      NOTE: showRolesAllowed - Shows the roles that a user

      is a member of

      NOTE: isInRole - Shows whether a role is assumed

      NOTE: isAuthorized - Shows whether access is authorized

      NOTE: isAuthorizedActions - Shows whether access is

      authorized to actions

      NOTE: isAuthorizedTables - Shows whether access is authorized

      to tables

      NOTE: isAuthorizedColumns - Shows whether access is authorized

      to columns

      NOTE: listAllPrincipals - Lists all principals that have

      explicit access controls

      NOTE: whatIsEffective - Lists effective access and

      explanations (Origins)

      NOTE: partition - Partitions a table

      NOTE: recordCount - Shows the number of rows in a Cloud

      Analytic Services table

      NOTE: loadDataSource - Loads one or more data source interfaces

      NOTE: update - Updates rows in a table

      The printed notes describe all of the CAS action sets and the actions in those action sets. The help action also returns the action set and action information as a return value. The return values from all actions are in the form of CASResults objects, which are a subclass of the Python collections.OrderedDict class. To see a list of all of the keys, use the keys method just as you would with any Python dictionary. In this case, the keys correspond to the names of the CAS action sets.

      In [4]: list(out.keys())

       Out[4]:

      ['accessControl',

      'builtins',

      'configuration',

      'dataPreprocess',

      'dataStep',

      'percentile',

      'search',

      'session',

      'sessionProp',

      'simple',

      'table']

      Printing the contents of the return value shows all of the top-level keys as sections. In the case of the help action, the information about each action set is returned in a table in each section. These tables are stored in the dictionary as Pandas DataFrames.

      In [5]: out

       Out[5]:

      [accessControl]

      name description

      0 assumeRole Assumes a role

      1 dropRole Relinquishes a role

      2 showRolesIn Shows the currently active role

      3 showRolesAllowed Shows the roles that a user is a mem...

      4 isInRole Shows whether a role is assumed

      5 isAuthorized Shows whether access is authorized

      6 isAuthorizedActions Shows whether access is authorized t...

      7 isAuthorizedTables Shows whether access is authorized t...

      8 isAuthorizedColumns Shows whether access is authorized t...

      9 listAllPrincipals Lists all principals that have expli...

      10 whatIsEffective Lists effective access and explanati...

      11 listAcsData Lists access controls for caslibs, t...

      12 listAcsActionSet Lists access controls for an action ...

      13 repAllAcsCaslib Replaces all access controls for a c...

      14 repAllAcsTable Replaces all access controls for a t...

      15 repAllAcsColumn Replaces all access controls for a c...

      16 repAllAcsActionSet Replaces all access controls for an ...

      17 repAllAcsAction Replaces all access controls for an ...

      18 updSomeAcsCaslib Adds, deletes, and modifies some acc...

      19 updSomeAcsTable Adds, deletes, and modifies some acc...

      ... truncated ...

      + Elapsed: 0.0034s, user: 0.003s, mem: 0.164mb

      Since the output is based on the dictionary object, you can access each key individually as well.

      In [6]: out['builtins']

       Out[6]:

      name description

      0 addNode Adds a machine to the server

      1 removeNode Remove one or more machines from the...

      2 help Shows the parameters for an action o...

      3 listNodes Shows the host names used by the server

      4 loadActionSet Loads an action set for use in this ...

      5

Скачать книгу