Peewee query is as following:
q = AccountTab.get(AccountTab.id == 12345)
print(q.name)
What if name
here is stored in a variable, say user_name
. Is there something like this?
q = AccountTab.get(AccountTab.id == 12345)
print(q.#{user_name})
Thanks for your time!
getattr
will work:
user_name = 'name'
print(getattr(q, user_name))