Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Good way to generate GUIDs on app engine?

I was wondering if anyone knows of a good way to generate GUIDs on python google app engine. I feel like there is a simple way that people are using, what would you suggest.

like image 808
Alex Amato Avatar asked Jan 21 '11 22:01

Alex Amato


People also ask

What is the best method to change the app engine region?

You cannot change an app's region after you set it. Note: Two locations, which are called europe-west and us-central in App Engine commands and in the Google Cloud console, are called europe-west1 and us-central1 , respectively, elsewhere in Google documentation.

How do I make a global unique identifier?

Individuals and organizations can create GUIDs using a free GUID generator that is available online. An online generator constructs a unique GUID according to RFC 4122. When creating a GUID, users should note the timestamp, clock sequence and the node ID -- such as a Media Access Control (MAC) address.


2 Answers

The uuid module should be available.

Why do you need uuids? Usually they're necessary to make really unique primary keys, but GAE's datastore essentially ought to be taking care of that for you.

like image 80
Bob Aman Avatar answered Oct 07 '22 04:10

Bob Aman


Code example using the uuid module:

from uuid import uuid4

print(uuid4())

# Output: 7d720c5a-b3e9-455e-961c-0e37b330b098
like image 41
Aaron D Avatar answered Oct 07 '22 04:10

Aaron D