robosystems-client 0.2.7__py3-none-any.whl → 0.2.8__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of robosystems-client might be problematic. Click here for more details.

@@ -141,39 +141,100 @@ class QueryClient:
141
141
  if hasattr(response, "parsed") and response.parsed:
142
142
  response_data = response.parsed
143
143
 
144
- # Handle both dict and object responses
144
+ # Handle both dict and attrs object responses
145
145
  if isinstance(response_data, dict):
146
146
  # Response is a plain dict
147
147
  data = response_data
148
+ has_data = "data" in data and "columns" in data
148
149
  else:
149
- # Response is an object with additional_properties
150
- data = (
151
- response_data.additional_properties
152
- if hasattr(response_data, "additional_properties")
153
- else response_data
154
- )
150
+ # Response is an attrs object - check for attributes directly
151
+ data = response_data
152
+ has_data = hasattr(data, "data") and hasattr(data, "columns")
155
153
 
156
154
  # Check if this is an immediate response
157
- if "data" in data and "columns" in data:
155
+ if has_data:
156
+ # Extract data from either dict or attrs object
157
+ if isinstance(data, dict):
158
+ result_data = data["data"]
159
+ result_columns = data["columns"]
160
+ result_row_count = data.get("row_count", len(data["data"]))
161
+ result_execution_time = data.get("execution_time_ms", 0)
162
+ result_timestamp = data.get("timestamp", datetime.now().isoformat())
163
+ else:
164
+ # attrs object - access attributes directly
165
+ from ..types import UNSET
166
+
167
+ raw_data = data.data if data.data is not UNSET else []
168
+ # Convert data items to dicts if they're objects
169
+ result_data = []
170
+ for item in raw_data:
171
+ if hasattr(item, "to_dict"):
172
+ result_data.append(item.to_dict())
173
+ elif hasattr(item, "additional_properties"):
174
+ result_data.append(item.additional_properties)
175
+ else:
176
+ result_data.append(item)
177
+ result_columns = data.columns if data.columns is not UNSET else []
178
+ result_row_count = (
179
+ data.row_count if data.row_count is not UNSET else len(result_data)
180
+ )
181
+ result_execution_time = (
182
+ data.execution_time_ms if data.execution_time_ms is not UNSET else 0
183
+ )
184
+ result_timestamp = (
185
+ data.timestamp
186
+ if data.timestamp is not UNSET
187
+ else datetime.now().isoformat()
188
+ )
189
+
158
190
  return QueryResult(
159
- data=data["data"],
160
- columns=data["columns"],
161
- row_count=data.get("row_count", len(data["data"])),
162
- execution_time_ms=data.get("execution_time_ms", 0),
191
+ data=result_data,
192
+ columns=result_columns,
193
+ row_count=result_row_count,
194
+ execution_time_ms=result_execution_time,
163
195
  graph_id=graph_id,
164
- timestamp=data.get("timestamp", datetime.now().isoformat()),
196
+ timestamp=result_timestamp,
165
197
  )
166
198
 
167
199
  # Check if this is a queued response
168
- if data.get("status") == "queued" and "operation_id" in data:
169
- queued_response = QueuedQueryResponse(
170
- status=data["status"],
171
- operation_id=data["operation_id"],
172
- queue_position=data.get("queue_position", 0),
173
- estimated_wait_seconds=data.get("estimated_wait_seconds", 0),
174
- message=data.get("message", "Query queued"),
200
+ is_queued = False
201
+ queued_response = None
202
+
203
+ if isinstance(data, dict):
204
+ is_queued = data.get("status") == "queued" and "operation_id" in data
205
+ if is_queued:
206
+ queued_response = QueuedQueryResponse(
207
+ status=data["status"],
208
+ operation_id=data["operation_id"],
209
+ queue_position=data.get("queue_position", 0),
210
+ estimated_wait_seconds=data.get("estimated_wait_seconds", 0),
211
+ message=data.get("message", "Query queued"),
212
+ )
213
+ else:
214
+ is_queued = (
215
+ hasattr(data, "status")
216
+ and hasattr(data, "operation_id")
217
+ and getattr(data, "status", None) == "queued"
175
218
  )
219
+ if is_queued:
220
+ from ..types import UNSET
221
+
222
+ queued_response = QueuedQueryResponse(
223
+ status=data.status,
224
+ operation_id=data.operation_id,
225
+ queue_position=data.queue_position
226
+ if hasattr(data, "queue_position") and data.queue_position is not UNSET
227
+ else 0,
228
+ estimated_wait_seconds=data.estimated_wait_seconds
229
+ if hasattr(data, "estimated_wait_seconds")
230
+ and data.estimated_wait_seconds is not UNSET
231
+ else 0,
232
+ message=data.message
233
+ if hasattr(data, "message") and data.message is not UNSET
234
+ else "Query queued",
235
+ )
176
236
 
237
+ if is_queued and queued_response:
177
238
  # Notify about queue status
178
239
  if options.on_queue_update:
179
240
  options.on_queue_update(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: robosystems-client
3
- Version: 0.2.7
3
+ Version: 0.2.8
4
4
  Summary: Python Client for RoboSystems financial graph database API
5
5
  Author: RFS LLC
6
6
  License: MIT
@@ -135,7 +135,7 @@ robosystems_client/extensions/dataframe_utils.py,sha256=gK1bgkVqBF0TvWVdGQvqWrt-
135
135
  robosystems_client/extensions/extensions.py,sha256=ROnCobUek4Dke9dVx2sTzNKhz309NOG40EDSYHtNmWs,6257
136
136
  robosystems_client/extensions/graph_client.py,sha256=OBi0xj0SLIRKLeSu_DiGt2ZakCmhggvNrMP3jdRfEgQ,10326
137
137
  robosystems_client/extensions/operation_client.py,sha256=B1qju-wWQrnrnVJixKGgsA_KEInviwJwdlJxzm_i7P0,13359
138
- robosystems_client/extensions/query_client.py,sha256=-4g1tE3QMM6WggV01W8U9jTJV6hL-00V1T_tvcKb3d0,16949
138
+ robosystems_client/extensions/query_client.py,sha256=cX3e8EBoTeg4Lwm6edJYRULM2UmGpfqNX3f48S8TQbE,19430
139
139
  robosystems_client/extensions/sse_client.py,sha256=XvQIq3JQ0Yiax11E7cwclhupShYOpEMURM2cYQodiz8,15058
140
140
  robosystems_client/extensions/table_ingest_client.py,sha256=H-gJBsYshEfiJ3KTIE3yjspUjQWLIYFKuttrmfRjFdk,12873
141
141
  robosystems_client/extensions/token_utils.py,sha256=qCK_s1vBzRnSYwtgncPZRLJVIw3WXmzqNTWjdEEpdgs,10899
@@ -375,7 +375,7 @@ robosystems_client/models/user_usage_response_graphs.py,sha256=xAH-ZnhaUfWQ_2EpZ
375
375
  robosystems_client/models/user_usage_summary_response.py,sha256=4hthwTH7bXyzdYlHoekDYOgDLI-stGRH507Bl2rUjYA,3655
376
376
  robosystems_client/models/user_usage_summary_response_usage_vs_limits.py,sha256=XrZnRcy1nD3xtKX4svbww7QfEHrN7_XIfeL9j5ZMbyQ,1298
377
377
  robosystems_client/models/validation_error.py,sha256=R77OuQG2nJ3WDFfY--xbEhg6x1D7gAAp_1UdnG8Ka2A,1949
378
- robosystems_client-0.2.7.dist-info/METADATA,sha256=d8108sRLbIc6bJBbGx_pDcnj21HAejrSzGFFowIYasE,3903
379
- robosystems_client-0.2.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
380
- robosystems_client-0.2.7.dist-info/licenses/LICENSE,sha256=LjFqQPU4eQh7jAQ04SmE9eC0j74HCdXvzbo0hjW4mWo,1063
381
- robosystems_client-0.2.7.dist-info/RECORD,,
378
+ robosystems_client-0.2.8.dist-info/METADATA,sha256=AShLe4Foo6kgRdRz6Hsu0VcRWgwyPr7ZVu3XTKWswxI,3903
379
+ robosystems_client-0.2.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
380
+ robosystems_client-0.2.8.dist-info/licenses/LICENSE,sha256=LjFqQPU4eQh7jAQ04SmE9eC0j74HCdXvzbo0hjW4mWo,1063
381
+ robosystems_client-0.2.8.dist-info/RECORD,,