You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Reflection should raise the proper Exception type when things are not found #38
Right now, when reflection fails, it's usually with a KeyError, but the other sqlalchemy dialects raise sa.exc.NoSuch<object>Error. I have code that depends on this exception being raised, which is how I found this issue.
I grepped through sqlalchemy core and found that indeed sybase, postgresql, and mysql all raise NoSuchTableError for specific functions (postgres has a get_table_oid method that raises it, mysql raises when doing a show create table or describe mytable statements, sybase has a similar mechanism to postgres).
For other dialects I think the error is raised here (in the Inspector class):
Activity
cpcloud commentedon Sep 4, 2015
This was introduced in 1b911f2
cpcloud commentedon Sep 4, 2015
It looks like only
sa.exc.NoSuchTableErroris relevant during reflectiongraingert commentedon Sep 4, 2015
Ah nice catch! Do you have the docs for this?
cpcloud commentedon Sep 4, 2015
There's the docs for the exception: http://docs.sqlalchemy.org/en/rel_1_0/core/exceptions.html?highlight=nosuchtableerror#sqlalchemy.exc.NoSuchTableError
I'm looking for the usage docs (if any) right now.
cpcloud commentedon Sep 4, 2015
I don't see anything here explicitly stating what exceptions should be raised in the case of not finding tables: http://docs.sqlalchemy.org/en/rel_1_0/core/reflection.html
I grepped through sqlalchemy core and found that indeed sybase, postgresql, and mysql all raise
NoSuchTableErrorfor specific functions (postgres has aget_table_oidmethod that raises it, mysql raises when doing ashow create tableordescribe mytablestatements, sybase has a similar mechanism to postgres).For other dialects I think the error is raised here (in the
Inspectorclass):https://github.com/zzzeek/sqlalchemy/blob/master/lib/sqlalchemy/engine/reflection.py#L570-L571