Ticket #2081 (closed task: wontfix)
Model Package import issues
| Reported by: | jorge.vargas | Owned by: | anonymous |
|---|---|---|---|
| Priority: | high | Milestone: | 2.1rc1 |
| Component: | SQLAlchemy | Version: | trunk |
| Severity: | normal | Keywords: | |
| Cc: |
Description
Given the way SQLAlchemy is initialized it currently create a potential name collision between the user defined modules (model/*.py) and ANY top level module in the python installation.
I'm not saying this is a bug because it's documented but it is something we should take care of. The chances of a name collision are too high and the results too obscure specially to new developers just starting out.
For example Jon, creates project myfirstapp, then goes into model copies over model.templates and names it well myfirstapp, when he runs setup-app everything goes to hell because model.init.py is loading from myfrstapp import * which basically throws things off.
The worst part of this is that any top level package is affect so if you name your model file tg.py or even something on the stdlib things will go wrong.
I'm setting this as a task because we should investigate how other big project handle this issue.
Change History
comment:2 Changed 3 years ago by jorge.vargas
I'm not entirely sure about that. The fact that you have to import things at the end of the file is weird.
Hmm, this is mostly just about understanding how python works. We can perhaps make it a little easier, but IMHO really we can't solve the problem in any reasonable way.