我有以下代码:
name = sess.query(
table
).filter(
getattr(
table,
[i for i in dir(table) if i == 'name'][0]).table_propherty.in_([1,2,3]),
table.table != 'INVALID'
).all()
return name
因此,当我尝试使用getattr过滤表并获取object和他的属性(例如table_propherty)时,我会遵循Traceback
Traceback (most recent call last):
File "/home/project/env/lib/python3.7/site-packages/gevent/pywsgi.py", line 976, in handle_one_response
self.run_application()
File "/home/project/env/lib/python3.7/site-packages/gevent/pywsgi.py", line 923, in run_application
self.result = self.application(self.environ, self.start_response)
File "/home/project/env/lib/python3.7/site-packages/sentry_sdk/integrations/flask.py", line 66, in sentry_patched_wsgi_app
return old_app(self, environ, start_response)