Re: Invoke commands with custom env.py from library

2020-03-05 Thread Daniel Cardin
12:21:54 PM UTC-5, Mike Bayer wrote: > > > > On Thu, Mar 5, 2020, at 12:02 PM, Daniel Cardin wrote: > > So, yes I mean "commands" as in `alembic.command.upgrade()`. > > The idea would be that the library defines an env.py (e.g. the important >

Re: Invoke commands with custom env.py from library

2020-03-05 Thread Daniel Cardin
y, March 5, 2020 at 9:36:09 AM UTC-5, Mike Bayer wrote: > > > > On Thu, Mar 5, 2020, at 8:08 AM, Daniel Cardin wrote: > > I am attempting to write a library which invokes alembic commands, while > referencing the migrations of a separate package which has instal

Invoke commands with custom env.py from library

2020-03-05 Thread Daniel Cardin
I am attempting to write a library which invokes alembic commands, while referencing the migrations of a separate package which has installed said library. The intent here, is for the library to invoke the alembic commands with an env.py defined in that package. This seems to work through

Re: [sqlalchemy] Global pre-filter of queries containing a given model.

2018-10-18 Thread Daniel Cardin
Fair enough, I was expecting something like that to be the case anyhow. Thank you very much! On Thursday, October 18, 2018 at 2:33:20 PM UTC-4, Mike Bayer wrote: > > On Thu, Oct 18, 2018 at 12:31 PM Daniel Cardin > wrote: > > > > O, very nice thanks! This appe

Re: [sqlalchemy] Global pre-filter of queries containing a given model.

2018-10-18 Thread Daniel Cardin
t I could (naively) see the joinedload in the middle causing that to be the problem. Is there a way to ensure this works for joined relationships as well? On Wednesday, October 17, 2018 at 10:24:50 PM UTC-4, Mike Bayer wrote: > > On Wed, Oct 17, 2018 at 11:57 AM Daniel Cardin > wrote:

[sqlalchemy] Global pre-filter of queries containing a given model.

2018-10-17 Thread Daniel Cardin
I would like add a global filter to all queries emitted against a particular table. In particular, its important that it doesn't *require* changes to existing queries; and it would be nice if there was an escape hatch. I'm aware of the following 2 recipes that googling this returns:

Re: [sqlalchemy] Conditionally ordered nested relationships

2018-06-11 Thread Daniel Cardin
> > the fact that you are changing the order of things_check seems to > imply you want the order of parent_feature.things to change also > but you're not changing the query. > Ugh, woops again. Yes that's exactly what i meant! in which case you would use contains_eager() > Wow okay,

Re: [sqlalchemy] Conditionally ordered nested relationships

2018-06-08 Thread Daniel Cardin
Aha i didn't realize I had a mismatch of relationship names Below I included a full example that fails an assert where I'm having the issue. - The only reason I have "unordered_things" and "things" relationships is because I wasn't sure how to get it to only include the query's sort -

Re: [sqlalchemy] Conditionally ordered nested relationships

2018-06-08 Thread Daniel Cardin
So "ParentFeature.shows" is there for the case where I query `pg.query(Parent)`, I want it to be ordered ascending. The only reason i have "ParentFeature.unordered_shows" is because if I try to apply an `order_by` to `Thing.name` in a query (like my query example), it emits "ORDER BY

[sqlalchemy] Conditionally ordered nested relationships

2018-06-08 Thread Daniel Cardin
I'm attempting to a sort of complex relationship filter/sort operation. I need to filter results by the id of a parent relationship, and then sort a nested relationship by one of its attributes class Parent(Base): __tablename__ = 'parent' id = Column(types.Integer, primary_key=True,