SQLAlchemy + MSSQL - 可以使用反射来判断 table 列是否为计算列?

SQLAlchemy + MSSQL - Possible to tell using reflection if table column is a computed column?

我在 MSSQL 中有一个 table,它使用多个 "computed" 列。使用反射,是否可以在检查这些列之一时判断它们是计算出来的而不是典型的列?

是的,你使用 sys.columns table:

   -- object_id - tablename
   -- name - column name
 select case when is_computed=0 then 'Not Computed' 
        else 'Computed'end [Is Computed] 
        from sys.columns 
        where object_id=object_id('dbo.x1') and name ='i1'