袁聪的第一次提交,包含nl2sql,行情数据,场外申购
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from typing import Any
|
||||
from typing import Any, cast
|
||||
|
||||
from sqlalchemy import MetaData, Table, insert, select, update
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
@@ -66,7 +66,9 @@ class PlatformRepository:
|
||||
async def create(self, name: str, values: dict[str, Any]) -> dict[str, Any]:
|
||||
table = await self.table(name)
|
||||
result = await self.session.execute(insert(table).values(**values))
|
||||
row_id = int(result.inserted_primary_key[0]) # type: ignore[attr-defined]
|
||||
inserted_primary_key = cast(Any, result).inserted_primary_key
|
||||
assert inserted_primary_key is not None
|
||||
row_id = int(inserted_primary_key[0])
|
||||
row = await self.get(name, row_id)
|
||||
assert row is not None
|
||||
return row
|
||||
|
||||
Reference in New Issue
Block a user