Skip to content

Commit

Permalink
fix query string handling for bound statements
Browse files Browse the repository at this point in the history
  • Loading branch information
soad003 committed Dec 20, 2023
1 parent f7694b9 commit 3802f6e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions src/graphsenselib/db/cassandra.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,12 @@ def on_write_timeout(self, *args, **kwargs):
return (self.RETHROW, None)

def on_request_error(self, query, consistency, error, retry_num):
if (
query.query_string.upper().startswith("SELECT ")
and retry_num < self.max_retries
):
query_string = (
query.prepared_statement.query_string
if isinstance(query, BoundStatement)
else query.query_string
)
if query_string.upper().startswith("SELECT ") and retry_num < self.max_retries:
logger.warning(
f"Error while executing request; was read; retry on next host: {error}"
)
Expand Down
2 changes: 1 addition & 1 deletion src/graphsenselib/utils/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def configure_logging(loglevel):
logging.getLogger("requests").setLevel(logging.WARNING)
logging.getLogger("urllib3").setLevel(logging.ERROR)
logging.getLogger("ProgressLogger").setLevel(logging.ERROR)
logging.getLogger("BatchWorkExecutor").setLevel(logging.DEBUG)
logging.getLogger("BatchWorkExecutor").setLevel(logging.ERROR)
else:
logging.getLogger("cassandra").setLevel(logging.WARNING)
logging.getLogger("ethereumetl").setLevel(logging.WARNING)
Expand Down

0 comments on commit 3802f6e

Please sign in to comment.