I am trying to create a flask-tryton
route that uses a read/write sub-transaction in processing a GET
request (where GET
s are readonly in flask-tryton
).[1] The sub-transaction creates a record, but when that sub-transaction exits and workflow returns to the initial transaction, the record doesn’t appear to exist, although the record is persisted to the database.
The code is essentially:
CognitoRecord = Pool().get('cognito_record')
with Transaction().new_transaction(readonly=False) as txn:
CognitoRecord.create([get_cognito_record()])
txn.connection.commit()
CognitoRecord.search([]) # returns []
Despite the search returning []
, the record does exist in the database, and can be viewed in the GTK.
Is this the expected behavior? Is there a pattern I should consider here?
Thanks, in advance, for your insight!
[1] The use case is an integration with AWS Cognito, where authentication confirmation is retrieved and stored during the GET
.