Skip to content

Commit 3b31f8d

Browse files
add promote_table method
1 parent eb5ac5f commit 3b31f8d

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

src/sasctl/_services/cas_management.py

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,4 +317,41 @@ def update_state_table(cls, value: str, name: str, caslib:str=None, server:str=N
317317
json=body
318318
)
319319

320-
return tbl
320+
return tbl
321+
322+
@classmethod
323+
def promote_table(cls, name: str, sessId: str, caslib: str, server: str = None):
324+
"""Changes the scope of a loaded CAS table from session to global scope.
325+
Operation valid only on a session table.
326+
Promote target is the same Caslib that contains the session table.
327+
328+
Parameters
329+
----------
330+
name : str
331+
Name of the table.
332+
sessId: str
333+
The session ID
334+
caslib : str
335+
Name of the caslib.
336+
server : str
337+
Server where the `caslib` is registered. Defaults to CASUSER
338+
339+
Returns
340+
-------
341+
RestObj
342+
343+
"""
344+
server = server or DEFAULT_SERVER
345+
caslib = caslib or DEFAULT_CASLIB
346+
347+
query={
348+
"value" : "global"
349+
"sessionId": sessId
350+
}
351+
352+
tbl = cls.put(
353+
"/servers/%s/caslibs/%s/tables/%s/scope" % (server, caslib, name),
354+
params=query
355+
)
356+
357+
return tbl

0 commit comments

Comments
 (0)