Vote count:
0
I'm trying to create a method in my class which will let me use an arbitrarily sized set of columns to filter the results from a sqlachemy query. Something like:
def Find(self, **kwargs):
f = self.db_session.filter(**kwargs).first()
However, the .filter() method requires arguments in the format table_name.column_name == value. In this case the table name is always fixed, and I'm passing in the column_name/value as the key/value pair in the kwargs dictionary.
Is there a way I'm not seeing to manipulate the dictionary passed through in the Find() method to input the arguments to filter() in the correct format?
asked 31 secs ago
python - construct method arguments using **kwargs?
Aucun commentaire:
Enregistrer un commentaire