def persist(self, name=None, dataverse=None): if self.schema is None: raise ValueError('Cannot write to AsterixDB!') if name is None: raise ValueError('Need to provide a name for the new dataset.') self.create_tmp_dataverse(dataverse) if dataverse: new_q = 'create dataset %s.%s(TempType) primary key _uuid autogenerated;' % ( dataverse, name) new_q += '\n insert into %s.%s select value ((%s));' % ( dataverse, name, self.query[:-1]) result = af.AFrame.send(new_q) return af.AFrame(dataverse, name) else: new_q = 'create dataset _Temp.%s(TempType) primary key _uuid autogenerated;' % name new_q += '\n insert into _Temp.%s select value ((%s));' % ( name, self.query[:-1]) result = af.AFrame.send(new_q) return af.AFrame('_Temp', name)
def toAframe(self): dataverse, dataset = self.get_dataverse() return af.AFrame(dataverse, dataset)