Skip to content

Commit

Permalink
Merge branch 'fix/SIN-395' of https://github.com/scaliseraoul/pandas-ai
Browse files Browse the repository at this point in the history
… into fix/SIN-395

* 'fix/SIN-395' of https://github.com/scaliseraoul/pandas-ai:
  Update pandasai/query_builders/sql_parser.py
  Update pandasai/helpers/sql_sanitizer.py
  • Loading branch information
scaliseraoul committed Feb 27, 2025
2 parents 791eba9 + 077ac9c commit c3ccb4b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pandasai/helpers/sql_sanitizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def is_sql_query_safe(query: str, dialect: str = "postgres") -> bool:
return False


def is_sql_query(query):
def is_sql_query(query: str) -> bool:
# Define SQL patterns with context to avoid standalone keyword matches
sql_patterns = [
r"\bSELECT\b.*\bFROM\b",
Expand Down
2 changes: 1 addition & 1 deletion pandasai/query_builders/sql_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def transform_node(node):
return transformed.sql(pretty=True)

@staticmethod
def transpile_sql_dialect(query: str, to_dialect, from_dialect=None):
def transpile_sql_dialect(query: str, to_dialect: str, from_dialect: Optional[str] = None):
placeholder = "___PLACEHOLDER___"
query = query.replace("%s", placeholder)
query = (
Expand Down

0 comments on commit c3ccb4b

Please sign in to comment.