Afternoon All,

> Hello Guys,
>
> I have an object which I save to the database using SQLAlchemy, the class
is defined using
> declarative and has a whole bunch of properties.
>
> This object has one property though which isn't saved to the database, but
to the file system.
> It is basically a binary string of a files contents.
>
> I essentially want to write this binary content to the file system when
the record is created
> in the database, and likewise, delete the file from the FS when the record
is removed from the 
> database.
>
> I understand all the basics of writing a file, it's just a case of how to
implement this into
> the ORMified object.
>
> How would you handle this? Presumably it'll involve creating a couple of
methods in the 
> class which handle the file save/delete process, but how do I tie these to
the save/delete 
> methods of the ORM? And furthermore, are there any smart ways of making
this 
> transactional so if either the database write fails or the file write
fails then the 
> they are both rolledback so I don't end up with db records without files
and files 
> without dbrecords?
>
> I'd really appreciate your thoughts on the cleanest way to implement this.
>
> Heston

I wanted to bump this topic as I'm still a little confused as to how it
might implement. I've been doing a little reading this afternoon about
mapper extensions, would this be a decent use of that do you think for
after_create and after_delete?

I really appreciate your input guys, being new to the ORM scene and a lonely
programmer with no one to bounce ideas off this has got me baffled.

Heston


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to