fix(dataset): 展示训练任务名称
This commit is contained in:
@@ -1151,12 +1151,25 @@ class PlatformStore:
|
||||
|
||||
def datasets(self) -> list[dict[str, Any]]:
|
||||
with self.connect() as conn:
|
||||
rows = conn.execute("SELECT * FROM datasets ORDER BY create_time DESC").fetchall()
|
||||
rows = conn.execute(
|
||||
"""SELECT dataset.*, task.name AS task_name
|
||||
FROM datasets dataset
|
||||
LEFT JOIN data_process_tasks task
|
||||
ON task.id=COALESCE(dataset.source_task_id, dataset.task_id)
|
||||
ORDER BY dataset.create_time DESC"""
|
||||
).fetchall()
|
||||
return [self._dataset(conn, row) for row in rows]
|
||||
|
||||
def dataset(self, dataset_id: str) -> dict[str, Any]:
|
||||
with self.connect() as conn:
|
||||
row = conn.execute("SELECT * FROM datasets WHERE id=?", (dataset_id,)).fetchone()
|
||||
row = conn.execute(
|
||||
"""SELECT dataset.*, task.name AS task_name
|
||||
FROM datasets dataset
|
||||
LEFT JOIN data_process_tasks task
|
||||
ON task.id=COALESCE(dataset.source_task_id, dataset.task_id)
|
||||
WHERE dataset.id=?""",
|
||||
(dataset_id,),
|
||||
).fetchone()
|
||||
if not row:
|
||||
raise KeyError(dataset_id)
|
||||
return self._dataset(conn, row)
|
||||
|
||||
Reference in New Issue
Block a user