Jose Soares ha scritto:
> Michael Bayer ha scritto:
>
>> not sure about that, i thought maybe the multiple flush()es are
>> breaking something but I just added a test case and it doesnt
>> reproduce. make sure youre on the most recent versions since that was
>> broken a few versions back...
>>
>>
>>
> This error happens some times, not every time.
> my versione is SQLAlchemy-0.3.0
>
> jo
>
>
>
Hi Mike,
I upgraded to 0.3.4
but this function works only without create_transaction()...
def add_user(self,data):
#transaction = session.create_transaction()
try:
anagrafica = Anagrafica(
nome = data.get('display_name'),
email = data.get('email'),
)
session.save(anagrafica)
session.flush()
user = User(
id_anagrafica = anagrafica.id, #ultimo record
inserito in anagrafica
data_inizio_attivita = data.get('data_inizio_attivita'),
data_fine_attivita = data.get('data_fine_attivita'),
)
for item in data.get('dettaglio'):
if item.get('cod_ruolo'):
user.ruoli.append(UserGroup(
id_operatore = item.get('id_operatore'),
group_id = item.get('cod_ruolo'),
id_asl = item.get('id_asl'),
)
)
session.save(user)
session.flush()
#transaction.commit()
return "inserito il record %d!"%user.id
except:
#transaction.rollback()
jo
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---