'How to clone a SQLAlchemy object including attached files?
I want to clone a SQLAlchemy object:
That can be done like this:
report = reports.all()[0]
db.session.expunge(report)
make_transient(report)
report.id = None
db.session.add(report)
try:
db.session.commit()
except SQLAlchemyError:
db.session.rollback()
But table contains attachment column.
That attached files/images are stored in file system.
For newly created/cloned row, the file/image is not created/cloned in the file system.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
