Nicol van der Merwe wrote:
> My problem is when I am trying to execute a stored procedure and use the
> commit and rollback features of sqlAlchemy.
the issue is the usage of db.bind.execute("statement"). This system uses
SQLA's "autocommit" behavior which is not detecting the textual statements
you're passing along as in need of a "commit".
to issue the "commit", use either a text() construct which specifies
autocommit=True, or use an explicit Transaction/Connection as described in
http://www.sqlalchemy.org/docs/05/dbengine.html#using-transactions-with-connection
.
>
> When I execute a simple stored procedure, one that inserts a row into a
> table and returns one result, it works as expected. It executes
> successfully
> and returns the expected result. (NOTE : I have had to resort to a couple
> of
> caveats in order for this to work - to see what I mean see the attached
> file.). When I try to execute another quite complex stored procedure it
> returns the expected results, generates no errors, fails silently - but
> the
> inserts/updates it should have executed is not present in the database.
>
> I have compiled an example script to demonstrate the problem (attached).
> The
> first simple stored procedure works as expected. The second complex stored
> procedure *only* persists to the database if 'COMMIT' is appended. The
> third
> (the same stored procedure and same parameters as the second) executes
> successfully, returns the expected output - but *doesn't* persist its
> changes to the database.
>
> I need to be able to execute the stored procedure inside a transaction so
> that I can rollback/commit at the appropriate time, however if I include
> 'COMMIT' as described above it is commited (obviously :) ) prematurely.
>
>
> --
> Nicolaas
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" 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/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---