Commit 548edcc
Fix _iquery DataFrame conversion for non-tuple results_type
_iquery must always return List[Dict[str, Any]], but when the connection
uses a non-tuple results_type (polars, pandas, numpy, arrow), the
specialized cursor's fetchall() returns a DataFrame/ndarray instead of
tuples. The previous code had two bugs:
1. list() on a DataFrame iterates by columns, producing Series objects
instead of row dicts.
2. to_dict(orient='records') is pandas-specific and fails on polars.
Dispatch on the raw fetchall() result type before converting to dicts:
- pandas DataFrame: to_dict(orient='records')
- polars DataFrame: to_dicts()
- Arrow Table: to_pydict() with column-to-row transposition
- numpy ndarray: tolist() with cursor.description column names
- tuples/dicts: existing logic preserved
Centralize fix_names camelCase conversion as a single post-processing
step applied uniformly to all result types.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>1 parent fe1d8ad commit 548edcc
1 file changed
Lines changed: 49 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1167 | 1167 | | |
1168 | 1168 | | |
1169 | 1169 | | |
1170 | | - | |
1171 | | - | |
1172 | | - | |
1173 | | - | |
| 1170 | + | |
1174 | 1171 | | |
1175 | | - | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
1176 | 1187 | | |
1177 | 1188 | | |
1178 | | - | |
1179 | | - | |
1180 | | - | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| 1194 | + | |
| 1195 | + | |
| 1196 | + | |
| 1197 | + | |
| 1198 | + | |
| 1199 | + | |
| 1200 | + | |
| 1201 | + | |
| 1202 | + | |
| 1203 | + | |
| 1204 | + | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
1181 | 1222 | | |
1182 | 1223 | | |
1183 | 1224 | | |
| |||
0 commit comments