On Jun 29, 1:22 pm, durumdara <[email protected]> wrote:
> Hi!
>
> I have a problem with PGSQL and dbutils, because I need to finalize my
> db connections.
>
> The Postgresql have two trs. modes. The first is "in-transaction
> mode", and the second is "autocommit" mode.
> My experience is that when I use dbutils/pgdb with it's "in-
> transaction mode", and I make only "select" on a table, and I do not
> rollback it - it "locks" this table, and I cannot alter it.
>
> Sometimes the transactions are remaining in "non-committed" state (non-
> handled exceptions, redirecting, etc.), so I search for a way to
> finalize them.
>
> But: I don't want to make a try/finally blocks for each requests.
>
> Please help me: have the Pylons a possibility where I can hook to a
> postprocess thread method?
>
> A method that called after each process - and where I can reset my db
> connections?
>
> Other way if I make my own dbutils: I put the db objects to a list on
> __del__, and I can re-call them on when I need to use them. In my way:
> auto-rollback on die, auto-rollback on birth...
> But this is gc-dependent are, so possible it would be better if I can
> handle them in pylons-level, not in gc-level...
>
> Thanks for your help!
>
> dd
Are you using sqlalchemy? I think autoflush or autocommit on the
sessionmaker is what you would want.
http://www.sqlalchemy.org/docs/05/reference/orm/sessions.html?highlight=sessionmaker#sqlalchemy.orm.sessionmaker
have a look in the model/__init__.py of your pylons project
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---