Re: [sqlalchemy] Re: Outer joins?

2016-03-19 Thread Alex Hall
That would be the simplest. Having something so inefficient just bugs me. :) I'm using MSSQL, so limit() works. Would yield_per() help here, or is that for something different? Even if it didn't help local memory, but just kept the load on the DB server down, that would be good. On 3/16/16,

[sqlalchemy] Re: Outer joins?

2016-03-19 Thread Jonathan Vanasco
We all inherit less-than-ideal situations. If this is running once a day and isn't impacting performance or other work, I wouldn't really worry about the huge join matrix. It sounds like the current solution is "good enough". In a few weeks or months you'll be better acquainted with

Re: [sqlalchemy] Re: Outer joins?

2016-03-16 Thread Alex Hall
> On Mar 16, 2016, at 03:23, Jonathan Vanasco wrote: > > The database design you have is less than perfect. I didn't make it, I came in long after it had been set up and now have to work with it. I can't re-do anything. They did it this way so that, for instance, a

Re: [sqlalchemy] Re: Outer joins?

2016-03-16 Thread Jonathan Vanasco
The database design you have is less than perfect. The goal of having to reformat the relational DB into a CSV is less than perfect. If I were you, I would think about 3 questions: 1. How often do you have to run this? 2. Does it take too long? 3. Does it use up too much DB/Python memory? If

Re: [sqlalchemy] Re: Outer joins?

2016-03-15 Thread Alex Hall
Thanks guys. I'm using automap, but I'm not completely sure how much that gives me for free. Yes, these tables are big, and the resulting set would be worrying large (potentially 5*20, and that's without the attributes and attachments, plus their assignment and values tables). I've switched to

Re: [sqlalchemy] Re: Outer joins?

2016-03-15 Thread Christopher Lee
Note that if your items have a lot of attributes and attachments, an outer-join will return a multiplicatively-large result set. That will get boiled down into a sane number of objects by the SqlAlchemy ORM, but your performance might be ugly in terms of I/O to your database, or the processing

[sqlalchemy] Re: Outer joins?

2016-03-15 Thread Jonathan Vanasco
The ORM has an `outerjoin` method on queries: http://docs.sqlalchemy.org/en/latest/orm/query.html#sqlalchemy.orm.query.Query.outerjoin You can also pass "isouter=True" to `join` http://docs.sqlalchemy.org/en/latest/orm/query.html#sqlalchemy.orm.query.Query.join The core supports an

[sqlalchemy] Re: Outer joins with ORM and single table polymorphism

2009-02-05 Thread MikeCo
After some experimenting I am able to generate the correct query by two methods (1) build query from ORM classes with ORM session.query() (2) build query from underlying tables with sql expressions I like the ORM based method better, because the code does not need to know which columns

[sqlalchemy] Re: Outer joins with ORM and single table polymorphism

2009-02-02 Thread Michael Bayer
outerjoin() will bridge between multiple tables if you specify a list to a single outerjoin() call (see the examples in the reference documentation). However for joined table inheritance with the ORM no explicit joining is necessary, see the documenation on using with_polymorphic in the

[sqlalchemy] Re: Outer joins with ORM and single table polymorphism

2009-02-01 Thread MikeCo
Oops, the description should say Inputs are stored in a single table with column kind as a discriminator. On Feb 1, 10:58 pm, MikeCo mconl...@gmail.com wrote: I can't figure out how to write this outer join query in ORM-speak. Jobs have Steps; Steps have optional inputs of type SRC1, SRC2, or