lp:~cjwatson/storm/is-and-is-not-operators

Created by Colin Watson and last modified
Get this branch:
bzr branch lp:~cjwatson/storm/is-and-is-not-operators
Only Colin Watson can upload to this branch. If you are Colin Watson please log in for upload directions.

Branch merges

Related bugs

Related blueprints

Branch information

Owner:
Colin Watson
Project:
Storm
Status:
Merged

Recent revisions

577. By Colin Watson

Add storm.expr.Is and storm.expr.IsNot operators.

Launchpad has had custom `IsTrue` and `IsFalse` operators for a while,
because there are a few places where `expr` or `expr == True` (or the
equivalents for False) don't quite do what we need: for example, if
you're working with a nullable boolean column, then SQL NULL semantics
mean that `expr = TRUE` or `expr = FALSE` return NULL when `expr` is
NULL, which can be undesirable at times.

In addition, `==` and `!=` comparisons with True/False/None are
typically picked up as errors by modern linters, since in normal Python
code they should use `is` or `is not` or simple boolean tests instead.
Having to override this is an annoyance.

Compare
https://docs.sqlalchemy.org/en/20/core/operators.html#identity-comparisons,
although SQLAlchemy is more permissive; it seems to be happy to compile
anything on the right-hand-side of `IS` or `IS NOT` and leave it up to
the database. Since we already have to take some care with how booleans
are rendered, and there's no guarantee that the spelling of `IS TRUE`
etc. is going to match the way that boolean values themselves are
spelled, I thought it better to limit the set of right-hand-side
expressions that we will compile.

I've checked that current versions of all the databases currently
supported by Storm (PostgreSQL, MySQL, and SQLite) support all the
resulting expressions, although in the case of SQLite it does need at
least version 3.23.0 (released in 2018).

576. By Colin Watson

[r=ilasc] Clarify exception for a property with allow_none=False and default=None.

575. By Colin Watson

[r=cjwatson] Fix a typo in the tutorial doctest code block

574. By Colin Watson

[r=ilasc] Fix test compatibility with MySQL >= 8.0.24.

573. By Colin Watson

Bump version to 0.25.0.99.

572. By Colin Watson

Avoid traceback reference cycles when wrapping exceptions. [r=ilasc]

571. By Colin Watson

Release Storm 0.25.

570. By Colin Watson

Fix MANIFEST.in prune syntax.

569. By Colin Watson

[r=ilasc] Support Python 3.9.

568. By Colin Watson

[r=ilasc] Restore MySQL support.

Branch metadata

Branch format:
Branch format 7
Repository format:
Bazaar repository format 2a (needs bzr 1.16 or later)
Stacked on:
lp:storm
This branch contains Public information 
Everyone can see this information.