-
Notifications
You must be signed in to change notification settings - Fork 31
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
Refactoring: Modularize CrateCompiler
#498
Conversation
_column_as_key, | ||
_getattr_col_key, | ||
_col_bind_name, | ||
) = _key_getters_for_crud_column(compiler, stmt) |
Check failure
Code scanning / CodeQL
Wrong number of arguments in a call
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.
CodeQL is comparing apples with oranges here and below. I think it does not get SQLAlchemy's versions right, and compares the wrong versions.
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.
Let's see if it will get fixed by GH-499.
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 think CodeQL will not be smart enough to handle this case, when a code base contains code which calls functions or methods in 3rd-party libraries with different signatures, because of their evolutions across different versions.
So, I think we will have to go with manually dismissing those Wrong number of arguments in a call
admonitions. Please correct me if I am wrong.
_scan_insert_from_select_cols( | ||
compiler, | ||
stmt, | ||
parameters, | ||
_getattr_col_key, | ||
_column_as_key, | ||
_col_bind_name, | ||
check_columns, | ||
values, | ||
kw, | ||
) |
Check failure
Code scanning / CodeQL
Wrong number of arguments in a call
_scan_cols( | ||
compiler, | ||
stmt, | ||
parameters, | ||
_getattr_col_key, | ||
_column_as_key, | ||
_col_bind_name, | ||
check_columns, | ||
values, | ||
kw, | ||
) |
Check failure
Code scanning / CodeQL
Wrong number of arguments in a call
""" | ||
|
||
if stmt._has_multi_parameters: | ||
values = _extend_values_for_multiparams(compiler, stmt, values, kw) |
Check failure
Code scanning / CodeQL
Wrong number of arguments in a call
48640bb
to
248d60e
Compare
By refactoring the SQLAlchemy 1.0-1.3 vs. 1.4 specialities of the `CrateCompiler` (`visit_update` and `_get_crud_params`) into dedicated modules, the new layout is more suitable for bringing in support for SQLAlchemy 2.0.
248d60e
to
e969ae3
Compare
|
||
if self.ctes: | ||
nesting_level = len(self.stack) if not toplevel else None | ||
text = self._render_cte_clause(nesting_level=nesting_level) + text |
Check failure
Code scanning / CodeQL
Wrong name for an argument in a call
_column_as_key, | ||
_getattr_col_key, | ||
_col_bind_name, | ||
) = getters = _key_getters_for_crud_column(compiler, stmt, compile_state) |
Check failure
Code scanning / CodeQL
Wrong number of arguments in a call
_scan_insert_from_select_cols( | ||
compiler, | ||
stmt, | ||
compile_state, | ||
parameters, | ||
_getattr_col_key, | ||
_column_as_key, | ||
_col_bind_name, | ||
check_columns, | ||
values, | ||
kw, | ||
) |
Check failure
Code scanning / CodeQL
Wrong number of arguments in a call
_scan_cols( | ||
compiler, | ||
stmt, | ||
compile_state, | ||
parameters, | ||
_getattr_col_key, | ||
_column_as_key, | ||
_col_bind_name, | ||
check_columns, | ||
values, | ||
kw, | ||
) |
Check failure
Code scanning / CodeQL
Wrong number of arguments in a call
values = _extend_values_for_multiparams( | ||
compiler, | ||
stmt, | ||
compile_state, | ||
values, | ||
_column_as_key, | ||
kw, | ||
) |
Check failure
Code scanning / CodeQL
Wrong number of arguments in a call
About
By refactoring the SQLAlchemy 1.0-1.3 vs. 1.4 specialities of the
CrateCompiler
(visit_update
and_get_crud_params
) into dedicated modules, the new layout is more suitable for bringing in support for SQLAlchemy 2.0.Details
Effectively, it moves code from
crate.client.sqlalchemy.compiler
intocrate.client.sqlalchemy.compat.core{10,14}
.References