One of the many reasons not to implement __lt__, is that the types are used 
with different databases. Those have had very different stories, especially 
enum labels may not have been added in the same order. Hence, defining and 
order may lead people to rely on it. But, on either side (postgresql or python) 
that may yield different behavior depending on the underlying db.

We could sort this out (but may not really be worth the pain, on a system that 
is in production 24/7). But we also have had bugs in the past, that boiled down 
to ill defined or non-sensical orders (e.g. inadvertently sorting objects based 
on their memory addresses [thank Python3 for fixing that]) That can work for 
suprisingly long periods of time, until it doesn't. So, though it may sound a 
bit too phisolophical or just silly, I'd rather not implement orders that don't 
exist. As Python3 chose to do (e.g. objects no longer have an implicit order)

Our use case is more about partitioning tables. The fact that an entity belongs 
to one partition or another doesn't make the entity greater or lower than any 
other.

Not being able to add the enum in the primary key often means we have to handle 
unique constraints manually, add surrogate keys, which are on some large tables 
uselessly space and time consuming.

I've read the issue. Our code base having been started quite a while back, 
we're using your enum recipe. We have implemented a few other behavior on top 
of that, that has delayed our migration to plain Python enums. Not sure if it 
would be worth doing in that setting or be a valid motivation to do the change. 
I may have some time, later in the summer (end of July, August). No promises.

Anyhow, thank you for your answer.

Regards,
Nicolas. 

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/e4fdb93a-3db5-4e27-bcb4-31cc61863d65%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to