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

Fix: python query runner didn't allow iterating lists #440

Merged
merged 1 commit into from
May 31, 2015
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
4 changes: 4 additions & 0 deletions redash/query_runner/python.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ def custom_import(name, globals=None, locals=None, fromlist=(), level=0):
def custom_get_item(obj, key):
return obj[key]

def custom_get_iter(obj):
return iter(obj)

def get_query_result(query_id):
try:
query = models.Query.get_by_id(query_id)
Expand Down Expand Up @@ -143,6 +146,7 @@ def run_query(self, query):
safe_builtins["_setattr_"] = setattr
safe_builtins["setattr"] = setattr
safe_builtins["_getitem_"] = custom_get_item
safe_builtins["_getiter_"] = custom_get_iter

script_locals = { "result" : { "rows" : [], "columns" : [] } }

Expand Down