Skip to content

Commit 57d5941

Browse files
committed
SA14: Improve inline documentation of CrateDB dialect compiler
1 parent 40dc580 commit 57d5941

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

src/crate/client/sqlalchemy/compiler.py

+23-10
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,14 @@ def visit_update(self, update_stmt, **kw):
230230
update_stmt, table_text
231231
)
232232

233-
# CrateDB amendment.
233+
# CrateDB patch.
234234
crud_params = self._get_crud_params(update_stmt, **kw)
235235

236236
text += table_text
237237

238238
text += ' SET '
239239

240-
# CrateDB amendment begin.
240+
# CrateDB patch begin.
241241
include_table = extra_froms and \
242242
self.render_table_with_column_in_update_from
243243

@@ -255,7 +255,7 @@ def visit_update(self, update_stmt, **kw):
255255
set_clauses.append(k + ' = ' + self.process(bindparam))
256256

257257
text += ', '.join(set_clauses)
258-
# CrateDB amendment end.
258+
# CrateDB patch end.
259259

260260
if self.returning or update_stmt._returning:
261261
if not self.returning:
@@ -393,7 +393,7 @@ def visit_update_14(self, update_stmt, **kw):
393393
update_stmt, update_stmt.table, render_extra_froms, **kw
394394
)
395395

396-
# CrateDB amendment.
396+
# CrateDB patch.
397397
crud_params = _get_crud_params_14(
398398
self, update_stmt, compile_state, **kw
399399
)
@@ -413,7 +413,7 @@ def visit_update_14(self, update_stmt, **kw):
413413

414414
text += " SET "
415415

416-
# CrateDB amendment begin.
416+
# CrateDB patch begin.
417417
include_table = extra_froms and \
418418
self.render_table_with_column_in_update_from
419419

@@ -431,7 +431,7 @@ def visit_update_14(self, update_stmt, **kw):
431431
set_clauses.append(clause)
432432

433433
text += ', '.join(set_clauses)
434-
# CrateDB amendment end.
434+
# CrateDB patch end.
435435

436436
if self.returning or update_stmt._returning:
437437
if self.returning_precedes_values:
@@ -610,10 +610,23 @@ def _get_crud_params_14(compiler, stmt, compile_state, **kw):
610610
kw,
611611
)
612612

613-
# CrateDB amendment.
614-
# The rewriting logic in `rewrite_update` and `visit_update` needs
615-
# adjustments here in order to prevent `sqlalchemy.exc.CompileError:
616-
# Unconsumed column names: characters_name, data['nested']`
613+
# CrateDB patch.
614+
#
615+
# This sanity check performed by SQLAlchemy currently needs to be
616+
# deactivated in order to satisfy the rewriting logic of the CrateDB
617+
# dialect in `rewrite_update` and `visit_update`.
618+
#
619+
# It can be quickly reproduced by activating this section and running the
620+
# test cases::
621+
#
622+
# ./bin/test -vvvv -t dict_test
623+
#
624+
# That croaks like::
625+
#
626+
# sqlalchemy.exc.CompileError: Unconsumed column names: characters_name, data['nested']
627+
#
628+
# TODO: Investigate why this is actually happening and eventually mitigate
629+
# the root cause.
617630
"""
618631
if parameters and stmt_parameter_tuples:
619632
check = (

0 commit comments

Comments
 (0)