0

I need to create filters by using a dictionary and converting it to SQLAlchemy object.

for example this is my dictionary:

dict = {"fire": 100, "water": 250}

and I want to create the following filter set:

filters = {Nature.fire==100, Nature.water==250}

to achieve that I can use a for loop:

filters = set()
for key, value in dict.items():

    filters.add(key==value) # <---- here is my issue

How do I convert the key string into an Sqlalchemy column? how to convert "fire" to Nature.fire

I looked it up and this question asks the opposite.

Kevin
  • 895
  • 7
  • 20

0 Answers0