Skip to content

Commit

Permalink
fix: str_to_bool and sql-limiter (#1489)
Browse files Browse the repository at this point in the history
* fix: str_to_bool and sql-limiter

* comments
  • Loading branch information
jczhong84 authored Aug 23, 2024
1 parent 7419b12 commit 8a53387
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions querybook/server/lib/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,5 +162,8 @@ def get_default_args(func):
}


def str_to_bool(value: Union[str, bool]):
return value.lower() in (True, "yes", "true", "t", "1")
def str_to_bool(value: Optional[str]) -> bool:
if value is None:
return False

return value.lower() in ("yes", "true", "t", "1")
2 changes: 1 addition & 1 deletion querybook/webapp/lib/sql-helper/sql-limiter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function getSelectStatementLimit(
language?: string
): Nullable<number> {
const tokens = tokenize(statement, { language });
const parsedStatement = simpleParse(tokens)[0];
const parsedStatement = simpleParse(tokens)?.[0] ?? [];

// Strip nested statements out of the query
const outerStatement: IToken[] = [];
Expand Down

0 comments on commit 8a53387

Please sign in to comment.