MCPcopy Create free account
hub / github.com/ActiveState/code / gen_select

Function gen_select

recipes/Python/577605_AuGenerate_Simple_SQL/recipe-577605.py:42–50  ·  view source on GitHub ↗
(table,keys="*",conddicts=None)

Source from the content-addressed store, hash-verified

40 return sql
41
42def gen_select(table,keys="*",conddicts=None):
43 if isinstance(keys, (tuple,list)):
44 keys=','.join(map(str,keys))
45 sql = 'select %s '%keys
46 sql += ' from %s '%table
47 if conddicts:
48 sql += ' where %s '%Dict2Str(conddicts,'and')
49 #print sql
50 return sql
51# Next , I will confirm ,
52# whether the datetime is valid
53from datetime import datetime

Callers 1

gensqlFunction · 0.85

Calls 3

mapFunction · 0.85
Dict2StrFunction · 0.85
joinMethod · 0.45

Tested by

no test coverage detected