在使用 SQLAlchemy 的内置 get_columns
方法时,我有时会收到以下警告:
SAWarning: Did not recognize type 'geography' of column 'column_name'
我将如何捕捉和处理该警告?这似乎不起作用:
try:
inspector = inspect(engine)
columns = inspector.get_columns(table_name)
return columns
except exc.SAWarning as sawex:
logger.error(sawex)
<do something here>