autoloading gives misleading error message when table doesn't exist
sqlalchemy.exceptions.ArgumentError: Table event has no primary key columns. Specify primary_key argument to mapper.
I'm going to tag this as postgres-only because I'm not sure. I'll have a look later, and try to fix it.
Comments (7)
-
repo owner -
repo owner - changed milestone to 0.3.0
need to verify if this is fixed or broken or what
-
Account Deleted Bah. Let's talk about how to do a proper report, shall we? It might have been important to mention the use of Mapper() in the original report, for example.
I've confirmed that Table("not_there", BoundMetaData, autoload=True) gives no errors. But any subsequent use of select(), for example, does an "SELECT FROM not_there": note the lack of fields in the SELECT; I guess this means that .select() expects that Table() has columns :-).
This whole thing started in 0.1 with .reflecttable() using the "columns for table X" Table() in information_schema: so if the table didn't exist, no columns were found. I haven't checked 0.2, but I'll assume the algorithm is the same, for now.
There's a "list of tables" Table in information_schema, and the has_table()
#31is implemented. I'll create an has_table() in information_schema and raise an exception there when autoloading. I can't submit the patch yet, as I can't seem to make the unittest fail when it should. -
repo owner - assigned issue to
- marked as major
my regard for
information_schema
gets lower every day:#60,#71. ive proposed on the list to drop the usage of information schema for reflection altogether (and probably, id move the entire "information_schema" module into the extensions package as it seems to be more or less pointless for real-world usage). -
Account Deleted - attached sqlalchemy-autoload.patch
when reflecting, raise NoSuchTableError if we got no columns. tested on sqlite3.2 and postgres8.1
-
repo owner - changed status to resolved
it doesnt quite work for MySQL, since MySQL is using
describe
and throws its own exception anyway. but for sqlite/postgres it works, still need to test mssql/oracle/firebird but since they are all row-based it should work there too, changeset:1589 -
repo owner - removed milestone
Removing milestone: 0.3.0 (automated comment)
- Log in to comment
the work here also combines in with what has to be done
#31and#98.if youre looking to help,
#31would be nifty.