2

Cloud SQL で GAE を使用しています。

これがドキュメントに記載されているように見えないので、理解を明確にするために質問したいと思いました。

トランザクションをグループ化する標準的な方法は次のとおりです。

def do_something_in_transaction(...)
  update my CloudSQL database record
  taskqueue.add(url='/path/to/my/worker', transactional=True)
  ...

db.run_in_transaction(do_something_in_transaction, ....)

クラウド SQL で動作すると仮定しますか?

また、run_in_transaction 呼び出し中に複数のレコード (つまり、必要なだけ) を更新/挿入/削除することはできますか?

すなわち:

def do_something_in_transaction(...)
   x_id = insert record into table x
   update table y record with x_id
   insert record into table a
   insert record into table b
   … etc
  taskqueue.add(url='/path/to/my/worker', transactional=True)

前もってありがとう、マット

4

1 に答える 1

2

それが db コンポーネントの一部であることを考えると、run_in_transaction はデータストアに固有のものだと思います。

CloudSQL の場合、SQL トランザクション コマンドの START TRANSACTION、COMMIT、ROLLBACK を使用します。

于 2012-11-14T15:26:18.167 に答える