ObjectDeletedError: Instance '<Account at 0x913092c>' has been
deleted.
<< # update session data in database
dbsession.acct_no = account.acct_no
db.commit()
>> dbsession.acct_no = account.acct_no
[snipped]
ObjectDeletedError: Instance '<Account at 0x913092c>' has been
deleted.
When a row is inserted in the database (MySQL) with .commit(), it
seems that the object has members which are no longer available. I
don't understand why???
Edgar
On Mar 25, 2:12 pm, edgarsmolow <[email protected]> wrote:
> I have a set of interdependent tables, including accounts and persons,
> where this is their relationship (i.e., for certain persons):
>
> PK: accounts.id INT AUTO_INCREMENT
> accounts.acct_holder_id = person.id
>
> PK: person.id INT AUTO_INCREMENT
> person.account_id = account.id
>
> When a new person's contact info is entered in a form, I want to add
> both the person and the account to the database. The account is added
> first (including some fields like status):
>
> account = model.Account()
> account.status = 'P'
> db = meta.Session()
> db.add(account)
> db.commit()
>
> The account.id field will be needed to set a field on the person
> table:
> person = model.Person()
> person.first_name = 'Fred'
> person.last_name = 'Flintstone'
> person.account_id = account.id
>
> How do I then determine account.id (i.e., the last row id on the
> account table)?
> I could not seem to find a practical code example.
>
> Thanks.
> Edgar
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---