I just wanted to suggest another approach that may work, at least as a
fallback.
When I upload files to Amazon S3 I track the activity in a logging table
(via sqlalchemy) that looks a bit like this:
id | filename | timestamp_upload_start | upload_status (bool) |
timestamp_deleted
Before
Problem solved.
Michael - you nailed it when you guessed:
if you have set an event listener on a single session that is definitely
the
actual Session object and not the thread local or the scoped_session or
anything
sa.event.listen was being passed the scoped_session instance, not an
Thanks for the idea, Jonathan! I was actually discussing such a fallback
watchdog on #postgresql earlier today. Now that I've been having event
troubles and it is highlighting atomicity issues with the db/filesystem
split, I'm definitely going to implement such a safety net.
I think the
Hao Yan h...@uber.com wrote:
Want to ask you guys opinions about this :In the spirit of separating
lifecycle of sqlalchemy session from actual operations on db, sqlalchemy
suggests the following pattern
(http://docs.sqlalchemy.org/en/rel_0_9/orm/session_basics.html ):
def
Russ russandheat...@gmail.com wrote:
I have a case where I 'm using threadlocal scoped_sessions and I'm storing a
file during a transaction. I want to delete the file if the transaction
rolls back for any reason. To handle this I use the event system, something
like so:
def
I have a case where I 'm using threadlocal scoped_sessions and I'm storing
a file during a transaction. I want to delete the file if the transaction
rolls back for any reason. To handle this I use the event system,
something like so:
def write_data(file_path, data):
with
Want to ask you guys opinions about this :In the spirit of separating
lifecycle of sqlalchemy session from actual operations on db, sqlalchemy
suggests the following pattern (
http://docs.sqlalchemy.org/en/rel_0_9/orm/session_basics.html ):
### this is a **better** (but not the only) way to do
do you mean to say event.listen(ormSess) here ?
Sorry... yes. Poor transcription/reduction.
if you have set an event listener on a single session that is definitely
the
actual Session object and not the thread local or the scoped_session or
anything, and that Session is hit by