I'm not able to reproduce that, and also this code should likely be replaced by 
our existing topological sort code.  Can you provide a succinct reproducing 
example ?


On Dec 1, 2011, at 2:22 AM, Robert Forkel wrote:

> Hi,
> trying to use Inspector.get_table_names with order_by='foreign_key'
> causes the following exception:
> 
> Traceback (most recent call last):
>  File "db_inspector.py", line 20, in <module>
>    for table in insp.get_table_names(schema=schema,
> order_by='foreign_key'):
>  File "lib/python2.6/site-packages/sqlalchemy/engine/reflection.py",
> line 173, in get_table_names
>    ordered_tnames.index(ref_pos, tname)
> TypeError: slice indices must be integers or None or have an __index__
> method
> 
> which can be remdied by the following patch:
> 
> (gulpenv)$ diff -crB lib/python2.6/site-packages/sqlalchemy/engine/
> reflection.py lib/python2.6/site-packages/sqlalchemy/engine/
> reflection.py.orig*** lib/python2.6/site-packages/sqlalchemy/engine/
> reflection.py 2011-12-01 08:15:01.600838080 +0100
> --- lib/python2.6/site-packages/sqlalchemy/engine/reflection.py.orig
> 2011-12-01 08:14:40.980828074 +0100
> ***************
> *** 169,175 ****
>                          if table_pos > ref_pos:
>                              ordered_tnames.pop(table_pos) # rtable
> moves up 1
>                              # insert just below rtable
> !                             ordered_tnames.insert(ref_pos, tname)
>              tnames = ordered_tnames
>          return tnames
> 
> --- 169,175 ----
>                          if table_pos > ref_pos:
>                              ordered_tnames.pop(table_pos) # rtable
> moves up 1
>                              # insert just below rtable
> !                             ordered_tnames.index(ref_pos, tname)
>              tnames = ordered_tnames
>          return tnames
> 
> best regards
> robert
> 
> -- 
> 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.
> 

-- 
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