Skip to content

Commit fa99182

Browse files
committed
Collapse template properties to inline one-liners
Same semantics — property with getter returning the fixed template and a no-op setter so super's assignment is silently discarded. 13 lines of @Property blocks reduced to 2 inline declarations, with a single comment explaining why the no-op setter exists. Co-authored-by: Isaac
1 parent 829192d commit fa99182

1 file changed

Lines changed: 5 additions & 15 deletions

File tree

src/databricks/sqlalchemy/_ddl.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -114,21 +114,11 @@ class DatabricksStatementCompiler(compiler.SQLCompiler):
114114

115115
_BIND_TEMPLATE = ":`%(name)s`"
116116

117-
@property
118-
def bindtemplate(self) -> str:
119-
return self._BIND_TEMPLATE
120-
121-
@bindtemplate.setter
122-
def bindtemplate(self, _ignored: str) -> None:
123-
pass
124-
125-
@property
126-
def compilation_bindtemplate(self) -> str:
127-
return self._BIND_TEMPLATE
128-
129-
@compilation_bindtemplate.setter
130-
def compilation_bindtemplate(self, _ignored: str) -> None:
131-
pass
117+
# The no-op setter makes ``SQLCompiler.__init__``'s assignment of the
118+
# default template a silent no-op so our class-level value is what
119+
# every render path reads.
120+
bindtemplate = property(lambda self: self._BIND_TEMPLATE, lambda self, _: None)
121+
compilation_bindtemplate = property(lambda self: self._BIND_TEMPLATE, lambda self, _: None)
132122

133123
def limit_clause(self, select, **kw):
134124
"""Identical to the default implementation of SQLCompiler.limit_clause except it writes LIMIT ALL instead of LIMIT -1,

0 commit comments

Comments
 (0)