1. Michael Bayer
  2. sqlalchemy
  3. Issues


Issue #3074 resolved

allow **kw for TypeCompiler, specifically pass the parent SQL expression or column

Michael Bayer
repo owner created an issue

this would allow type-compilation that can be altered by the properties of the enclosing column, such as if nullable affects things.

patch would use a conditional that allows legacy dialects to not require the **kw.

Comments (4)

  1. Michael Bayer reporter
    • Custom dialects that implement :class:.GenericTypeCompiler can now be constructed such that the visit methods receive an indication of the owning expression object, if any. Any visit method that accepts keyword arguments (e.g. **kw) will in most cases receive a keyword argument type_expression, referring to the expression object that the type is contained within. For columns in DDL, the dialect's compiler class may need to alter its get_column_specification() method to support this as well. The UserDefinedType.get_col_spec() method will also receive type_expression if it provides **kw in its argument signature. fixes #3074

    → <<cset f3a892a3ef66>>

  2. Michael Bayer reporter

    this needed to be in UserDefinedType.get_col_spec() for it to be worth it; so a new metaclass approach to transparently decorating methods with a **kw acceptor was added.

  3. Log in to comment