Skip to content

Commit f305291

Browse files
author
Kevin D Smith
committed
Add exists method and last-modified / created / last-accessed attributes
1 parent 8ad75b6 commit f305291

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

swat/cas/table.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import numpy as np
3535
import pandas as pd
3636
import six
37+
from .utils.datetime import sas2python_datetime
3738
from .utils.params import ParamManager, ActionParamManager
3839
from .utils.misc import super_dir
3940
from ..config import get_option
@@ -2381,6 +2382,28 @@ def next(self):
23812382
''' Return next item in the iteration '''
23822383
return StopIteration
23832384

2385+
def exists(self):
2386+
''' Return True if table exists in the server '''
2387+
return self._retrieve('table.tableexists')['exists'] > 0
2388+
2389+
@getattr_safe_property
2390+
def last_modified_date(self):
2391+
''' Return the last modified date of the table in the server '''
2392+
modtime = self._retrieve('table.tableinfo')['TableInfo']['ModTime'][0]
2393+
return sas2python_datetime(modtime)
2394+
2395+
@getattr_safe_property
2396+
def last_accessed_date(self):
2397+
''' Return the last access date of the table in the server '''
2398+
acctime = self._retrieve('table.tableinfo')['TableInfo']['AccessTime'][0]
2399+
return sas2python_datetime(acctime)
2400+
2401+
@getattr_safe_property
2402+
def created_date(self):
2403+
''' Return the created date of the table in the server '''
2404+
cretime = self._retrieve('table.tableinfo')['TableInfo']['CreateTime'][0]
2405+
return sas2python_datetime(cretime)
2406+
23842407
@getattr_safe_property
23852408
def _numcolumns(self):
23862409
''' Return number of visible columns '''

0 commit comments

Comments
 (0)