Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

fix(datasource): use case-insensitive check for LIMIT #1116

Merged
merged 1 commit into from
Sep 8, 2022
Merged
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
3 changes: 2 additions & 1 deletion chaos_genius/connectors/base_db.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import logging
import re

from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import exc as sqlalchemy_exc
Expand Down Expand Up @@ -104,7 +105,7 @@ def get_schema_metadata_from_query(self, query):
query = query.strip()
if query[-1] == ";":
query = query[:-1]
if "limit" not in query:
if not re.search(r"\s+limit\s+", query, re.IGNORECASE):
query += " limit 1 "

query_text = text(query)
Expand Down