as_sql(self, compiler, connection)
Responsible for producing the query string and parameters for the expression. The compiler
is an SQLCompiler
object, which has a compile()
method that can be used to compile other expressions. The connection
is the connection used to execute the query.
Calling expression.as_sql()
is usually incorrect - instead compiler.compile(expression)
should be used. The compiler.compile()
method will take care of calling vendor-specific methods of the expression.
Custom keyword arguments may be defined on this method if it’s likely that as_vendorname()
methods or subclasses will need to supply data to override the generation of the SQL string. See Func.as_sql()
for example usage.
Please login to continue.