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

DatabaseStatTracker - ValueError: None is not in list #102

Open
airamjimenez opened this issue Jul 7, 2014 · 0 comments
Open

DatabaseStatTracker - ValueError: None is not in list #102

airamjimenez opened this issue Jul 7, 2014 · 0 comments

Comments

@airamjimenez
Copy link

A exception is thrown (ValueError: None is not in list) if you have a text param that contains a sql keyword, module/sql line 76:
message = sqlparse.format(message, reindent=True, keyword_case='upper')

because the formatted_sql doesn't quote text param and sqlparse assumed that is a keyword not a regular text

i.e.:
sql = """INSERT INTO example ("name", "address") VALUES (%s, %s)"""
params = ("where", "other")
formatted_sql = sql % (params if isinstance(params, dict) else tuple(params))
message = sqlparse.format(message, reindent=True, keyword_case='upper')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant