Re: [sqlalchemy] [Question] Why not passing Connection URL query parameters to the dialect?

2022-01-07 Thread nicolas...@jobteaser.com
Don't get me wrong, I only have praises for the work currently being done on removing all the `bind`. It was one of the things that had me confused with SQLAlchemy when I started working with it some years back and also caused me a few headaches. And honestly after weighing the pros and cons, th

Re: [sqlalchemy] With loader criteria and baked query cache

2022-01-07 Thread Mike Bayer
i dont think with_loader_criteria ever expected the target entity to be part of "secondary" in a relationship(). I have no idea what that would do and I'm surprised it works at all. I would try instead to map from A->A_rel_B->B explicitly and use two relationships for this join. On Fri, Jan

[sqlalchemy] With loader criteria and baked query cache

2022-01-07 Thread Tomas Pavlovsky
Hello Mike, class X() id: id: int = Column( Integer, primary_key=True) a_id:int = Column(Integer, ForeignKey("A.id")) subq = select(A_rel_B).join(B).order(B.size).limit(10) class A() id: id: int = Column( Integer, primary_key=True) bs = relationship(B, viewonly=True, secondary=subq

Re: [sqlalchemy] [Question] Why not passing Connection URL query parameters to the dialect?

2022-01-07 Thread Jonathan Vanasco
> Ok. So if I understand you correctly, you want to keep query parameters solely for DBAPI drivers connection parameters and would hence not accept a PR that would implement something that changes that. Just adding: the standard across programming languages and database products/projects is to

Re: [sqlalchemy] [Question] Why not passing Connection URL query parameters to the dialect?

2022-01-07 Thread Mike Bayer
also if you really want your app to have just one URL with all kinds of config in it, then just use that. get the URL object using the make_url() API, pull out the configuration you need from URL.query, make a new URL from that one that is for your database, then connect.it's all public API

Re: [sqlalchemy] [Question] Why not passing Connection URL query parameters to the dialect?

2022-01-07 Thread Mike Bayer
the idea of Table objects being linked to a database is something I thought was a good idea in 2006, which is why for the last 15 years there's been this notion of "bound metadata" that associates a specific engine with Table objects. however, probably by 2009 if not earlier, the limited and m

[sqlalchemy] Create association of three or more tables

2022-01-07 Thread fco...@gmail.com
Hi all, I would like to create some association of, at least, 3 tables User, Org (organisation) and Role : a User is given a Role on an Organisation. So I began writing the following snippet but I am stucked as I do not know how I should write relationship() for User to be able to refer Orgs an

Re: [sqlalchemy] [Question] Why not passing Connection URL query parameters to the dialect?

2022-01-07 Thread nicolas...@jobteaser.com
Hi ! Ok. So if I understand you correctly, you want to keep query parameters solely for DBAPI drivers connection parameters and would hence not accept a PR that would implement something that changes that. There are other reasons though for which I was looking into this. In particular, what I