diff options
author | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-10-03 11:40:27 -0400 |
---|---|---|
committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2022-10-03 11:40:27 -0400 |
commit | b295a3b58f13d566c37244448218e4287f5e47ee (patch) | |
tree | 6104b0e4af66fc7ea1f538645181d451a90fdf78 /lib/sqlalchemy/sql/operators.py | |
parent | 6c180ab7434371bc0206e6fcd41df94061b82c80 (diff) | |
download | sqlalchemy-b295a3b58f13d566c37244448218e4287f5e47ee.tar.gz |
clarify precedence docs
Change-Id: I748f2736eb6382c8625b3419a82785b48766d8f7
references: #8584
Diffstat (limited to 'lib/sqlalchemy/sql/operators.py')
-rw-r--r-- | lib/sqlalchemy/sql/operators.py | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/lib/sqlalchemy/sql/operators.py b/lib/sqlalchemy/sql/operators.py index 49cf05f8d..55c275741 100644 --- a/lib/sqlalchemy/sql/operators.py +++ b/lib/sqlalchemy/sql/operators.py @@ -209,13 +209,20 @@ class Operators: between this element and the expression passed to the generated function. - :param precedence: precedence to apply to the operator, when - parenthesizing expressions. A lower number will cause the expression - to be parenthesized when applied against another operator with - higher precedence. The default value of ``0`` is lower than all - operators except for the comma (``,``) and ``AS`` operators. - A value of 100 will be higher or equal to all operators, and -100 - will be lower than or equal to all operators. + :param precedence: precedence which the database is expected to apply + to the operator in SQL expressions. This integer value acts as a hint + for the SQL compiler to know when explicit parenthesis should be + rendered around a particular operation. A lower number will cause the + expression to be parenthesized when applied against another operator + with higher precedence. The default value of ``0`` is lower than all + operators except for the comma (``,``) and ``AS`` operators. A value + of 100 will be higher or equal to all operators, and -100 will be + lower than or equal to all operators. + + .. seealso:: + + :ref:`faq_sql_expression_op_parenthesis` - detailed description + of how the SQLAlchemy SQL compiler renders parenthesis :param is_comparison: legacy; if True, the operator will be considered as a "comparison" operator, that is which evaluates to a boolean |