Generic function that accept a table and column name and returns all the primary key values that mat
- by nashr rafeeg
i have functions that look like this that is littered through out the code
def get_M_status(S):
M_id = merital.select(merital.c.marital_status_description == S).execute().fetchone()
if M_id == None:
print "Warning: No Marital id found for %s Merital status to Single" % S
M_id = merital.select(merital.c.marital_status_description == "Single").execute().fetchone()
return M_id[0]
i was wondering if their is a way to write a generic function where i can pass the relevant values ie: table name primary key column filter column and filter value
cheers