Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8029215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T00:22:10+00:00 2026-06-05T00:22:10+00:00

From my understanding, @db.transactional(xg=True) allows for transactions across groups, however the following code returns

  • 0

From my understanding, @db.transactional(xg=True) allows for transactions across groups, however the following code returns “queries inside transactions must have ancestors”.

@db.transactional(xg=True)
def insertUserID(self,userName):
    user = User.gql("WHERE userName = :1", userName).get()
    highestUser = User.all().order('-userID').get()
    nextUserID = highestID + 1 
    user.userID = nextUserID
    user.put()

Do you need to pass in the key for each entity despite being a cross group transaction? Can you please help modify this example accordingly?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T00:22:11+00:00Added an answer on June 5, 2026 at 12:22 am

    Cross group transactions allow you to perform a transaction across multiple groups, but they don’t remove the prohibition on queries inside transactions. You need to perform the query outside the transaction, and pass the ID of the entity in (and then check any invariants specified in the query still hold) – or, as Shay suggests, use IDs so you don’t have to do a query in the first place.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

From my understanding the following should properly throw a custom error from a WCF
I had 2 classes as below. From my understanding compiler must not complain at
I run the following code from a python interpreter, and expect the insert statement
I'm doing a small test. The following code runs 3 random queries 1000 times
From my understanding, AJAX requires the use of the XMLHttpRequest object. What I am
From my understanding if you implement an interface in java, the methods specified in
From my understanding, the expectation of vector (let's say nx1) is equivalent to finding
From my understanding, rownum is applied to the entire result set after it has
From my understanding, each of these methods: get() and put() are atomic. But, when
From my understanding of the docs this general approach should work: begin try1 rescue

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.