Good way to generate a GUID in an application?

I was wondering if anyone knows of a good way to generate a GUID in the Google engine for python. I feel that there is an easy way to use people, what would you suggest.

+8
python google-app-engine guid
source share
5 answers

The uuid module must be available.

Why do you need uuids? They are usually needed to make truly unique primary keys, but the GAE data warehouse, in essence, should take care of this for you.

+5
source share

Sample code using the uuid module:

from uuid import uuid4 print(uuid4()) # Output: 7d720c5a-b3e9-455e-961c-0e37b330b098 
+5
source share
 import uuid print(uuid.uuid4().hex) 
+1
source share

Assuming the module is available in the Google App Engine, check out the Python uuid module.

0
source share

Is it likely that they are for things that you store in the data warehouse?

If so, I believe object.key is a GUID

0
source share

Source: https://habr.com/ru/post/651361/


All Articles