fix: resolve numpy type conversion issues in ML service data access
- Convert numpy.int64 to Python int before passing to SQLAlchemy queries - Prevents psycopg2.ProgrammingError: can't adapt type 'numpy.int64' - Applied to get_candles(), get_span_annotations(), and get_point_annotations() - All ML service database access tests now passing successfully
This commit is contained in:
parent
5377431c9d
commit
d1557a3846
6 changed files with 437 additions and 119 deletions
|
|
@ -78,6 +78,9 @@ class DataAccess:
|
|||
DataFrame with columns: id, chart_id, time, open, high, low, close
|
||||
"""
|
||||
with get_db() as db:
|
||||
# Convert numpy types to native Python types for SQLAlchemy
|
||||
chart_id = int(chart_id)
|
||||
|
||||
# Build query
|
||||
stmt = select(self.candles).where(self.candles.c.chart_id == chart_id)
|
||||
|
||||
|
|
@ -118,6 +121,11 @@ class DataAccess:
|
|||
DataFrame with span annotations
|
||||
"""
|
||||
with get_db() as db:
|
||||
# Convert numpy types to native Python types for SQLAlchemy
|
||||
chart_id = int(chart_id)
|
||||
if min_confidence is not None:
|
||||
min_confidence = int(min_confidence)
|
||||
|
||||
# Build query
|
||||
stmt = select(self.span_annotations).where(
|
||||
self.span_annotations.c.chart_id == chart_id
|
||||
|
|
@ -164,6 +172,9 @@ class DataAccess:
|
|||
DataFrame with point annotations
|
||||
"""
|
||||
with get_db() as db:
|
||||
# Convert numpy types to native Python types for SQLAlchemy
|
||||
chart_id = int(chart_id)
|
||||
|
||||
# Build query
|
||||
stmt = select(self.annotations).where(
|
||||
self.annotations.c.chart_id == chart_id
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue