@@ -11,7 +11,7 @@ class SqliteEvaluationRowStore:
1111 """
1212 Lightweight reusable SQLite store for evaluation rows.
1313
14- Stores arbitrary row data as JSON keyed by a unique string `row_id `.
14+ Stores arbitrary row data as JSON keyed by a unique string `rollout_id `.
1515 """
1616
1717 def __init__ (self , db_path : str ):
@@ -24,7 +24,7 @@ class Meta:
2424 database = self ._db
2525
2626 class EvaluationRow (BaseModel ): # type: ignore
27- row_id = CharField (unique = True )
27+ rollout_id = CharField (unique = True )
2828 data = JSONField ()
2929
3030 self ._EvaluationRow = EvaluationRow
@@ -36,22 +36,22 @@ class EvaluationRow(BaseModel): # type: ignore
3636 def db_path (self ) -> str :
3737 return self ._db_path
3838
39- def upsert_row (self , row_id : str , data : dict ) -> None :
40- if self ._EvaluationRow .select ().where (self ._EvaluationRow .row_id == row_id ).exists ():
41- self ._EvaluationRow .update (data = data ).where (self ._EvaluationRow .row_id == row_id ).execute ()
39+ def upsert_row (self , rollout_id : str , data : dict ) -> None :
40+ if self ._EvaluationRow .select ().where (self ._EvaluationRow .rollout_id == rollout_id ).exists ():
41+ self ._EvaluationRow .update (data = data ).where (self ._EvaluationRow .rollout_id == rollout_id ).execute ()
4242 else :
43- self ._EvaluationRow .create (row_id = row_id , data = data )
43+ self ._EvaluationRow .create (rollout_id = rollout_id , data = data )
4444
45- def read_rows (self , row_id : Optional [str ] = None ) -> List [dict ]:
46- if row_id is None :
45+ def read_rows (self , rollout_id : Optional [str ] = None ) -> List [dict ]:
46+ if rollout_id is None :
4747 query = self ._EvaluationRow .select ().dicts ()
4848 else :
49- query = self ._EvaluationRow .select ().dicts ().where (self ._EvaluationRow .row_id == row_id )
49+ query = self ._EvaluationRow .select ().dicts ().where (self ._EvaluationRow .rollout_id == rollout_id )
5050 results = list (query )
5151 return [result ["data" ] for result in results ]
5252
53- def delete_row (self , row_id : str ) -> int :
54- return self ._EvaluationRow .delete ().where (self ._EvaluationRow .row_id == row_id ).execute ()
53+ def delete_row (self , rollout_id : str ) -> int :
54+ return self ._EvaluationRow .delete ().where (self ._EvaluationRow .rollout_id == rollout_id ).execute ()
5555
5656 def delete_all_rows (self ) -> int :
5757 return self ._EvaluationRow .delete ().execute ()
0 commit comments