def start(self): self.file.seek(0) d = DictReader(self.file) rows = [PluginResult(row) for row in d] shuffle(rows) self.results = iter(rows)
def query_single_record(self, query): """Query Salesforce through simple_salesforce and validate that query returns 1 and only 1 record""" qr = self.sf.query(query) records = qr.get("records") if not records: raise DataGenValueError(f"No records returned by query {query}", None, None) elif len(records) > 1: # pragma: no cover raise DataGenValueError( f"Multiple records returned by query {query}", None, None) record = records[0] if "attributes" in record: del record["attributes"] if len(record.keys()) == 1: return tuple(record.values())[0] else: return PluginResult(record)
def start(self): self.results = (PluginResult(dict(row)) for row in self.connection.execute(self.query()))
def start(self): self.file.seek(0) d = DictReader(self.file) self.results = (PluginResult(row) for row in d)