Given a record containing BlobReferences, return a new record with same schema, containing numpy arrays, fetched from the current active workspace.
(blob_record, ws=None, throw_on_type_mismatch=False)
| 1142 | |
| 1143 | |
| 1144 | def FetchRecord(blob_record, ws=None, throw_on_type_mismatch=False): |
| 1145 | """ |
| 1146 | Given a record containing BlobReferences, return a new record with same |
| 1147 | schema, containing numpy arrays, fetched from the current active workspace. |
| 1148 | """ |
| 1149 | |
| 1150 | def fetch(v): |
| 1151 | if ws is None: |
| 1152 | return workspace.FetchBlob(str(v)) |
| 1153 | else: |
| 1154 | return ws.blobs[str(v)].fetch() |
| 1155 | |
| 1156 | assert isinstance(blob_record, Field) |
| 1157 | field_blobs = blob_record.field_blobs() |
| 1158 | assert all(isinstance(v, BlobReference) for v in field_blobs) |
| 1159 | field_arrays = [fetch(value) for value in field_blobs] |
| 1160 | return from_blob_list(blob_record, field_arrays, throw_on_type_mismatch) |
| 1161 | |
| 1162 | |
| 1163 | def FeedRecord(blob_record, arrays, ws=None): |
searching dependent graphs…