Making a copy of a SQLAlchemy object
Should that be ‘a’ or ‘an’ SQLAlchemy object?
My current CMS project is based on creating templates in the back-end, and then using these to produce ‘inherited’ objects with the same attributes.

I quickly found that it’s surprisingly tricky to grab a template object using SQLAlchemy, and copy it into a similar, but separate, entity. Using the Python ‘copy’ function confuses SQLAlchemy – when you try to save it, it thinks it is merely a representation of the original (template) object.
Here’s how I create separate ‘clones’ from my template objects, defining a function on the object itself:
