Skip to content

Commit

Permalink
finxing py3 issue with dict keys and
Browse files Browse the repository at this point in the history
  • Loading branch information
josuebrunel committed Aug 20, 2015
1 parent 86be997 commit d46c076
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions myql/myql.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def __init__(self, community=True, format='json', jsonCompact=True, crossProduct
self._table = None
self._query = None # used to build query when using methods such as <select>, <insert>, ...
self._payload = {} # Last payload
self._vars = {}
self.diagnostics = diagnostics # Who knows, someone would like to turn it ON lol
self._limit = None
self._offset = None
Expand Down Expand Up @@ -182,13 +183,9 @@ def _func_filters(self, filters):
filters[i] = '{:s}(count={:d})'.format(*func)
elif isinstance(func, dict) :
func_stmt = ''
try:
func_name = func.keys()[0]
except: #Py3
func_name = list(func)[0]

value = [ "{0}='{1}'".format(v[0], v[1]) for v in func[func_name] ]
func_stmt = ','.join(value)
func_name = list(func.keys())[0] # Because of Py3
values = [ "{0}='{1}'".format(v[0], v[1]) for v in func[func_name] ]
func_stmt = ','.join(values)
func_stmt = '{0}({1})'.format(func_name, func_stmt)
filters[i] = func_stmt
else:
Expand Down Expand Up @@ -219,9 +216,9 @@ def use(self, url, name='mytable'):

##SET
def set(self, myvars):
'''Define variable to be substitute in the query
'''
'''
self._vars = myvars
self._vars.update(myvars)
return True

##DESC
Expand Down

0 comments on commit d46c076

Please sign in to comment.