Views

Command

sas-viya dagentsrv views create | show | delete --dsn dsn --name viewName
     [--sql sqltext | --sql-file filename ]

Where --sql sqltext and --sql-file filename is required for create.

Description

The views collection shows information about individual FedSQL views that are created in Cloud Data Exchange. A FedSQL view (also referred to as ‘view’) is like a table with respect to SQL queries, but does not contain any data itself. A view contains a definition of how to read the data. For example, a view can be used to provide access to a subset of a table for security purposes. A view is always defined by an SQL SELECT statement, which defines the view columns as the columns from the SELECT statement, and the source of the data as the FROM clause of the SELECT statement. To create a view, the FedSQL dialect must be selected in the DSN.

Creating a View

Command

sas-viya dagentsrv views create --dsn dsn --name viewName
     [--sql sqltext | --sql-file filename ]

Description

You can use the --name option to describe a multipart name for the table, including the catalog, schema, and view name. You must specify the DSN to hold the view contents. The command creates a new view of the given name in the specified data source name. You specify the SQL text that defines the view in one of three ways:

  • Using the --sql option on the command line, followed by the SQL text itself. This can have interactions with the command line shell that you are using regarding quoting and the “*” character.
  • Using the --sql-file option that names a text file that contains the SQL text to use.
  • If you omit both options, you are prompted to enter the SQL text from the console. In this case, the SQL can be entered on as many lines of text as needed, ending with a blank line.

Display a View Definition

Command

sas-viya dagentsrv views show --dsn dsnName --name viewName

Description

Displays information about the view. This is the SQL text that defines the view, reformatted using a pretty-print format.

Deleting a View

Command

sas-viya dagentsrv views delete --dsn dsn --name viewName

Description

This command deletes the view definition, but never affects the underlying data that the view represents.

Last updated: August 14, 2026