-
-
Notifications
You must be signed in to change notification settings - Fork 901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Specify a custom query class #319
Comments
Because I would prefer to pass it as an arg to the constructor and have that be reflected throughout, rather than accept it as part of |
Doing this properly will require passing the custom query class all the way down to The other issue is by default class SQLAlchemy(object):
# may as well provide for custom base models as well
# makes building something like SurrogatePKMixin easier
def __init__(self, query_class=BaseQuery, model_class=Model, **others):
self.Model = self.make_declarative_base(metadata, model_class)
# not crazy about this part
self.Model.query_class = query_class
self.Query = query_class |
is that the last fix required for milestone 2.1? |
Resolved in #328 |
Devise a cohesive way to be able to provide a custom query class, which would be used for
Model.query_class
,session
asqry_class
, be set fordb.Query
, be used fordb.relationship
anddb.backref
. Essentially everywhereBaseQuery
is used.Thanks to the contributions and discussion from @justanr, @davidism & @RonnyPfannschmidt.
The text was updated successfully, but these errors were encountered: