Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
- Replaced entity with getter (#652)
- Resolved TODO in Dockerfile (#680)
- Resolved TODO at src/reporter/tests/test_timescale_types.py (#667)
- Handled sql errors separately (#698)

### Bug fixes

Expand Down
11 changes: 8 additions & 3 deletions src/translators/sql_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from cache.factory import get_cache, is_cache_available
from translators.insert_splitter import to_insert_batches
from utils.connection_manager import Borg
from crate.client import exceptions
# NGSI TYPES
# Based on Orion output because official docs don't say much about these :(
NGSI_DATETIME = 'DateTime'
Expand Down Expand Up @@ -1122,10 +1123,14 @@ def query(self,
try:
self.cursor.execute(op)

except exceptions.ProgrammingError as e:
err_msg = self.sql_error_handler(e)
self.logger.error(str(e), exc_info=True)
entities = []
if err_msg:
message = err_msg
Comment on lines +1126 to +1131
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code belongs in the Crate translator I reckon?


except Exception as e:
# TODO due to this except in case of sql errors,
# all goes fine, and users gets 404 as result
# Reason 1: fiware_service_path column in legacy dbs.
Comment on lines -1126 to -1128
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what this actually means. Can anyone shed some light on it?

err_msg = self.sql_error_handler(e)
self.logger.error(str(e), exc_info=True)
entities = []
Expand Down