Skip to content

Commit f9cc61a

Browse files
committed
typed get()
1 parent c32cf09 commit f9cc61a

File tree

1 file changed

+3
-3
lines changed
  • src/opengeodeweb_microservice/database

1 file changed

+3
-3
lines changed

src/opengeodeweb_microservice/database/data.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
from sqlalchemy import String, JSON
1+
from sqlalchemy import String, JSON, select
22
from sqlalchemy.orm import Mapped, mapped_column
33
from .connection import get_session
44
from .base import Base
55
import uuid
6-
from typing import cast
76

87

98
class Data(Base):
@@ -47,4 +46,5 @@ def create(
4746
@staticmethod
4847
def get(data_id: str) -> "Data | None":
4948
session = get_session()
50-
return cast("Data | None", session.get(Data, data_id))
49+
data_query = select(Data).where(Data.id == data_id)
50+
return session.scalars(data_query).first()

0 commit comments

Comments
 (0)