[wingide-users] SQLAlchemy support?
Wingware Support
support at wingware.com
Tue Jun 15 09:29:27 MDT 2010
Marcin Krol wrote:
> Hello everyone,
>
> I'm spending a lot of time developing with SQLAlchemy toolkit, which
> is arguably the most popular Python ORM toolkit.
>
> Sadly, wing doesn't seem to be able to infer most of the sqla stuff,
> e.g. I have:
>
> Sesm=sessionmaker(bind=eng)
> session=Sesm()
>
> then:
>
> rsvp = session.query(Project.project,
> func.count(Reservation.project_id)).join(Reservation.project).group_by(Project.project,
> Project.id).all()
>
> ..and wing says
>
> Symbol: rsvp
> Cannot determine type
>
> SQLA objects are complex and it would be very useful to be able to
> look into them. Debugging just to look the contents of the object up
> is not always convenient, esp. with mod_python.
SQLAlchemy is written in a very dynamic way so it's difficult to analyze
that code statically. You could add the following so Wing knows what
session is:
from sqlalchemy.orm.session import Session
isinstance(session, Session)
Similarly for rsvp:
from sqlalchemy.orm.query import Query
isinstance(rsvp, Query)
If there are many places where you call sessionmaker() and
session.query() you could write a wrapper that includes these
isinstance() calls rather than sprinkling isinstance all over the place.
--
Stephan Deibel
Wingware | Python IDE
Advancing Software Development
www.wingware.com
More information about the wingide-users
mailing list