sasctl.services.data_sources#

class sasctl._services.data_sources.DataSources[source]#

Bases: Service

Enables retrieval of data source metadata.

The Data Sources API works in concert with the Data Tables and Row Sets APIs to navigate, reference, and retrieve data in the SAS Viya ecosystem. The Data Sources API enables retrieval of metadata for data sources and linking to their respective tables.

classmethod get_caslib(name, source=None)[source]#

Get a caslib by name.

Parameters:
  • name (str) – Name of the caslib

  • source (str, optional) – Name of the CAS server. Defaults to cas-shared-default.

Returns:

RestObj

classmethod get_provider(provider, refresh=False)[source]#

Returns a provider instance.

Parameters:
  • provider (str or dict) – Name, ID, or dictionary representation of the provider.

  • refresh (bool, optional) – Obtain an updated copy of the {item}.

Returns:

RestObj or None – A dictionary containing the provider attributes or None.

Notes

If provider is a complete representation of the provider it will be returned unless refresh is set. This prevents unnecessary REST calls when data is already available on the client.

classmethod get_source(provider, source)[source]#

Returns a data source belonging to a given provider.

Parameters:
  • provider (str or dict) – Name, ID, or dictionary representation of the provider.

  • source (str) – Name or id of the data source

Returns:

RestObj or None – A dictionary containing the data source attributes or None.

classmethod get_table(name, caslib, session_id=None)[source]#

Get metadata for a CAS table.

Parameters:
  • name (str) – Name of the table

  • caslib (str or dict) – Name, ID, or dictionary representation of the caslib.

Returns:

RestObj

classmethod list_caslibs(source='cas-shared-default', filter_=None)[source]#

Get all caslibs registered with the given CAS server.

Parameters:
  • source (str, optional) – Name of the CAS server. Defaults to cas-shared-default.

  • filter (str, optional)

Returns:

list – A collection of RestObj instances.

Notes

See the filtering reference for details on the filter parameter.

classmethod list_providers(filter=None, start=None, limit=None, **kwargs)#

List all providers available in the environment.

Parameters:
  • filter (str, optional)

  • start (int, optional) – Zero-based index of the first item to return. Defaults to 0.

  • limit (int, optional) – The maximum number of items to return. Defaults to 20.

Returns:

list – A list of dictionaries containing the providers.

Notes

See the filtering reference for details on the filter parameter.

classmethod list_sources(provider)[source]#

List all data sources available for a provider.

Parameters:

provider (str or dict) – Name, ID, or dictionary representation of the provider.

Returns:

list – A collection of RestObj instances.

classmethod list_tables(caslib, filter_=None, session_id=None)[source]#

List tables available in a caslib.

Parameters:
  • caslib (str or dict) – Name, ID, or dictionary representation of the caslib.

  • filter (str, optional)

  • session_id (str, optional) – ID of an existing CAS session to use. Otherwise a new session will be created.

Returns:

list – A collection of RestObj instances.

Notes

See the filtering reference for details on the filter parameter.

classmethod table_uri(table)[source]#

Get the URI identifying a table.

Parameters:

table (dict or swat.cas.table.CASTable)

Returns:

str – table URI