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.

Methods

delete(*args, **kwargs)

Send a DELETE request.

get(*args, **kwargs)

Send a GET request.

get_caslib(name[, source])

Get a caslib by name.

get_link(obj, rel)

Get link information from a resource.

get_provider(provider[, refresh])

Returns a provider instance.

get_source(provider, source)

Returns a data source belonging to a given provider.

get_table(name, caslib[, session_id])

Get metadata for a CAS table.

head(*args, **kwargs)

Send a HEAD request.

info()

Version and build information for the service.

is_available()

Check if the service is currently available.

list_caslibs([source, filter_])

Get all caslibs registered with the given CAS server.

list_providers([filter, start, limit])

List all providers available in the environment.

list_sources(provider)

List all data sources available for a provider.

list_tables(caslib[, filter_, session_id])

List tables available in a caslib.

post(*args, **kwargs)

Send a POST request.

put(*args, **kwargs)

Send a PUT request.

request(verb, path[, session, format_])

Send an HTTP request with a session.

request_link(obj, rel, **kwargs)

Request a link from a resource.

table_uri(table)

Get the URI identifying a table.

is_uuid

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

Get a caslib by name.

Parameters:
namestr

Name of the caslib

sourcestr, 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:
providerstr or dict

Name, ID, or dictionary representation of the provider.

refreshbool, 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:
providerstr or dict

Name, ID, or dictionary representation of the provider.

sourcestr

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:
namestr

Name of the table

caslibstr 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:
sourcestr, 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:
filterstr, optional
startint, optional

Zero-based index of the first item to return. Defaults to 0.

limitint, 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:
providerstr 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:
caslibstr or dict

Name, ID, or dictionary representation of the caslib.

filter_str, optional
session_idstr, 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:
tabledict or CASTable
Returns:
str

table URI