@@ -1056,6 +1056,7 @@ class BaseStudiesView(ObjectView, ListView):
10561056 "y" : fields .Float (required = False , allow_none = True ),
10571057 "z" : fields .Float (required = False , allow_none = True ),
10581058 "radius" : fields .Float (required = False , allow_none = True ),
1059+ ** LIST_NESTED_ARGS ,
10591060 }
10601061
10611062 _multi_search = ("name" , "description" )
@@ -1148,7 +1149,51 @@ def eager_load(self, q, args=None):
11481149 )
11491150
11501151 # Handle version and user loading
1151- if args .get ("info" ):
1152+ if args .get ("nested" ):
1153+ q = q .options (
1154+ selectinload (BaseStudy .versions ).options (
1155+ selectinload (Study .user )
1156+ .load_only (User .name , User .external_id )
1157+ .options (raiseload ("*" , sql_only = True )),
1158+ selectinload (Study .tables )
1159+ .load_only (Table .id )
1160+ .options (raiseload ("*" , sql_only = True )),
1161+ selectinload (Study .analyses ).options (
1162+ raiseload ("*" , sql_only = True ),
1163+ selectinload (Analysis .user )
1164+ .load_only (User .name , User .external_id )
1165+ .options (raiseload ("*" , sql_only = True )),
1166+ selectinload (Analysis .images ).options (
1167+ raiseload ("*" , sql_only = True ),
1168+ selectinload (Image .user )
1169+ .load_only (User .name , User .external_id )
1170+ .options (raiseload ("*" , sql_only = True )),
1171+ ),
1172+ selectinload (Analysis .points ).options (
1173+ raiseload ("*" , sql_only = True ),
1174+ selectinload (Point .user )
1175+ .load_only (User .name , User .external_id )
1176+ .options (raiseload ("*" , sql_only = True )),
1177+ selectinload (Point .values ).options (
1178+ raiseload ("*" , sql_only = True )
1179+ ),
1180+ ),
1181+ selectinload (Analysis .analysis_conditions ).options (
1182+ raiseload ("*" , sql_only = True ),
1183+ selectinload (AnalysisConditions .condition ).options (
1184+ raiseload ("*" , sql_only = True ),
1185+ selectinload (Condition .user )
1186+ .load_only (User .name , User .external_id )
1187+ .options (raiseload ("*" , sql_only = True )),
1188+ ),
1189+ ),
1190+ ),
1191+ ),
1192+ joinedload (BaseStudy .user )
1193+ .load_only (User .name , User .external_id )
1194+ .options (raiseload ("*" , sql_only = True )),
1195+ )
1196+ elif args .get ("info" ):
11521197 q = q .options (
11531198 joinedload (BaseStudy .versions ).options (
11541199 raiseload ("*" , sql_only = True ),
0 commit comments