def write_table(self,tablename,dsname=None,prefix=None,record=True,precision=None,args=(),makedir=False): t = getattr(self.rawdata,tablename,None) if t is None: methodname = 'list_'+tablename method = getattr(self,methodname,None) if method and callable(method): data = method(*args) t = Table(data=data,tablename=tablename,columns=getattr(self,'COLUMNS_'+tablename)) if t is None: raise ValueError("Unable to find table '{}'".format(tablename)) DataSource.write_table(t,dsname=dsname,prefix=prefix,tablename=tablename,precision=precision,makedir=makedir) if record: setattr(self.rawdata,tablename,t) return t
def get_table(self, tablename, extrasok=False, optional=False): columns = getattr(self, "COLUMNS_" + tablename) t = DataSource.read_table(tablename, columns=columns, optional=optional) return t
def __init__(self,dsname=None): self.dsname = dsname if dsname is not None: DataSource.set_source(dsname) self.reset()