Accessing column's `default` attribute after reflection

后端 未结 1 794
攒了一身酷
攒了一身酷 2021-01-29 01:26

As part of a sanity check I want to check if each column comes with a default value or function. When I create the table I can access this information through

相关标签:
1条回答
  • 2021-01-29 02:23

    default is the Python-level default. SQLAlchemy reflection puts the database column default in server_default:

    for c in table_reloaded.columns:
        print c.name, repr(c.server_default)
    
    0 讨论(0)
提交回复
热议问题