Persistence up and running with small fix
This commit is contained in:
parent
f99b8497ff
commit
a34206e6ff
|
@ -43,7 +43,6 @@ class Application(Repository):
|
||||||
try:
|
try:
|
||||||
application = Model(name=name, description=description, application_uuid=application_uuid)
|
application = Model(name=name, description=description, application_uuid=application_uuid)
|
||||||
self.session.add(application)
|
self.session.add(application)
|
||||||
self.session.flush()
|
|
||||||
self.session.commit()
|
self.session.commit()
|
||||||
return application
|
return application
|
||||||
except SQLAlchemyError as err:
|
except SQLAlchemyError as err:
|
||||||
|
@ -76,20 +75,24 @@ class Application(Repository):
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
self.session.query(Model).filter(Model.application_uuid == application_uuid).delete()
|
self.session.query(Model).filter(Model.application_uuid == application_uuid).delete()
|
||||||
|
self.session.flush()
|
||||||
self.session.commit()
|
self.session.commit()
|
||||||
except SQLAlchemyError as err:
|
except SQLAlchemyError as err:
|
||||||
logger.error(f'Error while deleting application: {err}')
|
logger.error(f'Error while deleting application: {err}')
|
||||||
|
|
||||||
def get_by_uuid(self, application_uuid: str) -> Model:
|
def get_by_uuid(self, application_uuid: str) -> Union[Model, None]:
|
||||||
"""
|
"""
|
||||||
Fetch Application based on the application uuid
|
Fetch Application based on the application uuid
|
||||||
:param application_uuid: the application uuid
|
:param application_uuid: the application uuid
|
||||||
:return: Application with the provided application_uuid
|
:return: Application with the provided application_uuid or None
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
return self.session.execute(select(Model).where(
|
result_set = self.session.execute(select(Model).where(
|
||||||
Model.application_uuid == application_uuid)
|
Model.application_uuid == application_uuid)
|
||||||
).first()[0]
|
).first()
|
||||||
|
if result_set is None:
|
||||||
|
return None
|
||||||
|
return result_set[0]
|
||||||
except SQLAlchemyError as err:
|
except SQLAlchemyError as err:
|
||||||
logger.error(f'Error while fetching application by application_uuid: {err}')
|
logger.error(f'Error while fetching application by application_uuid: {err}')
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
xmltodict
|
xmltodict
|
||||||
numpy
|
numpy
|
||||||
trimesh
|
trimesh[all]==3.12.0
|
||||||
pyproj
|
pyproj
|
||||||
pandas
|
pandas
|
||||||
requests
|
requests
|
||||||
|
|
Loading…
Reference in New Issue
Block a user