I am new to SQLAlchemy and I see that in the documentation the older version (Column) can be swapped directly with the newer "mapped_column".

Is there any advantage to using mapped_column over Column? Could you stick to the older 'Column'?

1 Answer

I think originally Column was used in the lower "core"/sqlalchemy.sql layer AND the higher ORM layer. This created a conflict of purpose. So mapped_column now supersedes Column when using the ORM layer to add more functionality that can't be used by the core layer. The core layer will keep using Column. So I think it is just meant to help you do more faster or more succinctly with the ORM.

There is a blurb about them titled "mapped_column() supersedes the use of Column()" below declarative-table-with-mapped-column.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.