On Dec 2, 2012, at 4:30 PM, Wolfgang Keller wrote:

>> Can I use the Guid as primary key? I am newbie to sql and mysql
>> management. 
> 
> Using such auto-generated surrogate keys is always a really bad idea
> and the straightest and shortest way to data inconsistency hell
> (especially through duplicates).

you've seen two guids generate as duplicates ?  the chances of that are smaller 
than something one would ever see in 100K years.

guids aren't very efficient when it comes to indexes on foreign key/primary key 
columns though, they take up a lot of space.

anyway you can use GUIDS in sqlalchemy just like:

import uuid
Column(String(32), default=lambda: uuid.uuid4().hex, primary_key=True)


-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to