Nope, I still use 0.9.7 J

It's not a big deal, just seemed odd, but thanks, I will look at it again once 
I move to 1.0 …

 

From: sqlalchemy@googlegroups.com [mailto:sqlalchemy@googlegroups.com] On 
Behalf Of Mike Bayer
Sent: Sunday, June 14, 2015 4:46 PM
To: sqlalchemy@googlegroups.com
Subject: Re: [sqlalchemy] MetaData.sorted_tables is inconsistant

 

 

On 6/14/15 9:06 AM, Ofir Herzas wrote:

It seems that MetaData.sorted_tables returns a different result each time. 

While the results seem to be always correct, it is an odd behavior.

A topological sort is non-deterministic.   If two elements A and B have no 
dependency on each other, they can be returned in either order.

However, the sorted_tables accessor was  specifically enhanced to use a 
deterministic sorting in 1.0, where the list of items passed to the topological 
algorithm is first sorted alphabetically, and an ordered set is used 
internally, so that it comes up with the same result each time.

So, did you try 1.0 ?







 

I would expect sorted_tables to return the same results every time

 

import sqlalchemy as sa
engine = sa.create_engine("<db_url>", echo=False)

meta = sa.MetaData(bind=engine, reflect=True)
a = [t.name for t in meta.sorted_tables]

meta = sa.MetaData(bind=engine, reflect=True)
b = [t.name for t in meta.sorted_tables]


a and b are not sorted the same

 

BTW: meta.tables is consistent ...

-- 
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 http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

 

-- 
You received this message because you are subscribed to a topic in the Google 
Groups "sqlalchemy" group.
To unsubscribe from this topic, visit 
https://groups.google.com/d/topic/sqlalchemy/eYZvKK12qTo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to 
sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

-- 
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 http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to