Michael Bayer wrote:
> Rodney Haynie wrote:
>
>> Michael Bayer wrote:
>>
>>> Rodney Haynie wrote:
>>>
>>>
>>>> I am having problems getting my data to save when the changes are made
>>>> through stored procedures.
>>>> I created a sample block of code below to show exactly how I am
>>>> implementing this.
>>>>
>>>> <code>
>>>> conn = DBSession.connection()
>>>> statement = sql.text("""CALL insert_test(321, 1);""")
>>>> results = conn.execute(statement).fetchall()
>>>> # The result set will have the new primary key value.
>>>> if results == []:
>>>> return None
>>>>
>>>> newID = results[0][0]
>>>> transaction.commit()
>>>> return newID
>>>> </code>
>>>>
>>>>
>>> what is "transaction" here ? it seems to be ephemeral.
>>>
>>> I failed to say this is a TG2 app. There is the transaction module I
>>> import at the top of the controller file.
>>>
>>>
>> import transaction
>>
>> I was trying different things, and I believe I don't need the code
>> "transaction.commit()". But I was grasping at straws.
>> Is there any way I can tell that the automatic transaction sees changes?
>>
>
> ive no idea what that is. I think in this case you're looking for:
>
> tranaction = conn.begin()
> ....
> transaction.commit()
>
>
Ok, tried it. Still no data being committed.
No errors popping either.
>
>
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---