Skip to content

Commit

Permalink
fix: Undefined name
Browse files Browse the repository at this point in the history
  • Loading branch information
felixrodrigo19 committed Dec 13, 2024
1 parent df5b4b2 commit 17e419f
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/product/adapters/postgresql_repository.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Dict, Any, Sequence, cast, Optional
from typing import Dict, Any, Sequence, Optional

from sqlalchemy import select, Row, delete
from sqlalchemy.dialects.postgresql import insert
Expand Down Expand Up @@ -29,9 +29,8 @@ def find_by_name(self, name: str) -> Optional[Row]:
return result[0]

def filter_by_id(self, product_id: str) -> Optional[Row]:
stmt = select(ProductTable).where(
cast("ColumnElement[bool]", ProductTable.id == product_id)
)
stmt = select(ProductTable).where(ProductTable.id == product_id)

result = self.session.execute(stmt).first()
if not result:
return
Expand All @@ -47,7 +46,6 @@ def insert_update(self, values: Dict[str, Any]):
self.session.execute(stmt)

def delete(self, product_id: str):
stmt = delete(ProductTable).where(
cast("ColumnElement[bool]", ProductTable.id == product_id)
)
stmt = delete(ProductTable).where(ProductTable.id == product_id)

self.session.execute(stmt)

0 comments on commit 17e419f

Please sign in to comment.