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
Ensure that 'client' is provided in knex config object #1822
Ensure that 'client' is provided in knex config object #1822
Conversation
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.
looks good
* Ensure that 'client' is provided in knex config object * sqlite3 columncompiler: Assign 'modifiers' --after-- super() call. * oracle columncompiler: Assign 'modifiers' --after-- super() call.
There is a small regression with this. Previously when calling |
I disagree with throwing the exception here. One of the documented features of Knex is:
I think we should revert the Exception bit, and treat the bug as fixed by the PR by adding |
Looks like this one actually was a breaking change, since there kind of was documented. I'm fine with reverting and releasing fixed version as 0.12.8 with explication in changelog. I don't like the feature of initializing builder without dialect, but it clearly was intended to work. @wubzz does it sound ok to you? or was there actually documentation somewhere that client was required configuration parameter? |
Actually yeah... other issue actually did state the place where it was mentioned.
So I think we should remove the invalid part of the documentation. I would prefer to have client as required, because currently trying to use knex without client is very badly tested and probably will keep on breaking in the future. But since there was inconsistent documentation about the feature this should have been made with minor version bump instead of patch version... |
Thanks @elhigu - I have found the "client-less" initializer to have been helpful over the years, but I understand your concerns. I am happy to help write better test coverage for the feature if that's desired. Another option would be to allow setting the client like |
@venables I still don't understand why clientless initialization is more helpful that for example just using Anyways if that feature is really wanted and better tested in that case |
I won't have all the use-cases for clientless initialization, but the use-cases that I've hit professionally have been:
All things we can work around, but I think it is a really great feature -- even if it were hid behind some sort of advanced This is a feature that Knex was advertising as a good thing, and I agree. |
@elhigu I still stand firm that 'client' should always be required. It's unfortunate that the documentation has double standards. The use cases above don't sound too convincing to me. One could just as easily supply |
@venables In both of those use cases one can initialize I still have not seen any case where You mentioned about using the base schema class... indeed most of the dialect differences are in schema. Is there any specific reasons why using base schema would be desired instead of some real schema of real dialect? For now I feel that the best choice would be to revert throwing the error, update changelogs and release 0.12.8. Then reapply the fix and release 0.13.0 and mark it as a breaking change and fix the documentation. |
@wubzz @elhigu Thanks for the response. The unit test use-case was my primary concern, but it looks like the database connection pool is not actually created until a query is executed -- which might be another piece of confusion from the documentation:
So I think we should be all set by setting our tests to Thank you again for looking into this. I'll close the Revert PR -- I'll leave the decision to you guys about 13.0 vs 12.8 |
My use case for this was to use Knex with IBMs DB2. Without specifying a client it actually generated valid queries, which the other client types do not seem to do. Oh well, I just resorted to manually writing my queries. |
The option is documented as required, but it's currently not being validated. This leads to strange side effects such as ones describe in #1628.
I also took the liberty of adding
modifiers
to the base columpcompiler as it currently does not have this property, but it should.