Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolved TODO in sql_translator.py #710 #717

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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)
- Resolved TODO in sql_translator.py (#710)

### 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 @@ -12,6 +12,7 @@
import dateutil.parser
from typing import Any, List, Optional, Sequence
from uuid import uuid4
import crate

from cache.factory import get_cache, is_cache_available
from translators.insert_splitter import to_insert_batches
Expand Down Expand Up @@ -1122,10 +1123,14 @@ def query(self,
try:
self.cursor.execute(op)

except crate.client.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.

@NEC-Vishal not sure what this is for? If you could please explain, maybe you can share some tests? Also as a side note, we can't put this code in here b/c it's Crate specific, so if that's a fix, we've got to push it down to the Crate translator. Btw, any idea what's happening in Timescale land?

Thanks alot for taking on this PR, much appreciated!


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.
err_msg = self.sql_error_handler(e)
self.logger.error(str(e), exc_info=True)
entities = []
Expand Down