Created
August 20, 2018 03:40
-
-
Save willard1218/784d61fe3fdae1d66e4ad84dc2b9822a to your computer and use it in GitHub Desktop.
dsfdsf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inputDict = {'Store_name': 'Los Angeles', | |
'Sales': '1500', | |
'XXX' :555} | |
whereConditions = [] | |
for key, value in inputDict.items(): | |
cond = "%s = '%s'" % (key, value) | |
whereConditions.append(cond) | |
whereConditionSql = ' AND '.join(whereConditions) | |
sql = 'select * from X where %s' % whereConditionSql | |
print(sql) | |
# "select * from X where Store_name = 'Los Angeles' AND Sales = '1500' AND XXX = '555'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment