Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
fix(sqlite): defer db connection until needed #3127
fix(sqlite): defer db connection until needed #3127
Changes from 12 commits
43fe224
157fd86
b36d41b
e94f511
7d68a5d
75406cc
7d32cf5
db05cc5
405dc85
d463c0d
3107c6a
c474003
4de2ded
3603e10
404b034
ab70fcf
02891dc
eca2830
5ff220e
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of mutating private attributes outside the class, how about taking
con_args
andcon_kwargs
as constructor arguments?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So do you mean, having a default BaseBackend() constructor that takes the same
*args, **kwargs
parameters as itsconnect()
/do_connect()
methods would take?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed a change, let me know if this is what you meant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we preserve this for backwards compatibilty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you look a few lines above this, it's still there, so you can continue to use
connect()
like you always have.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ahh fi that's the case, then just document connect & db_connect a bit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I'm not clear on what's missing, or where this documentation would go. Backends need to override the abstractmethod
do_connect
, but that's virtually identical to what they had to do previously withconnect
(as shown in this comment in the PR). What else do you need?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you cannot rename any of these methods as they r public
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, I'm proposing an API change. (See the toplevel comment I just posted.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jreback The top level API here isn't changing. Every backend still has the same
connect
API by way of threading args and options throughdo_connect
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure it is. this is leaking the
db_connect
into the base class where its not needed. you can move thebase
changes to the sql layer i think and achieve what you want.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, do_connect would be required for new backends or those that want to upgrade. I don't think I see the problem, we'd release a new major version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jreback Unfortunately the thing I need is to detach the object construction from the db connection, so I can copy Expr from any arbitrary db table and have them 'just work'. I think it's generally good practice to separate these two anyway--in my experience the constructor/factory should set initial state and not "do" anything, so it can't fail/raise which makes things more complicated for everyone.