Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.4 deprecated operators are not supported correctly #237

Open
rogalski opened this issue Feb 1, 2022 · 1 comment
Open

1.4 deprecated operators are not supported correctly #237

rogalski opened this issue Feb 1, 2022 · 1 comment

Comments

@rogalski
Copy link

rogalski commented Feb 1, 2022

SQLAlchemy 1.4 release notes:
https://docs.sqlalchemy.org/en/14/changelog/changelog_14.html#change-8dd50c1cc4d512bf97b23fb0243619af

Several operators are renamed to achieve more consistent naming across SQLAlchemy.

The operator changes are:
    isfalse is now is_false
    isnot_distinct_from is now is_not_distinct_from
    istrue is now is_true
    notbetween is now not_between
    notcontains is now not_contains
    notendswith is now not_endswith
    notilike is now not_ilike
    notlike is now not_like
    notmatch is now not_match
    notstartswith is now not_startswith
    nullsfirst is now nulls_first
    nullslast is now nulls_last
    isnot is now is_not
    not_in_ is now not_in

Stubs needs to be updated:

Module "sqlalchemy.sql.expression" has no attribute "nulls_last"; maybe "nullslast"?

Version:

Successfully installed sqlalchemy-stubs-0.4
@gward
Copy link

gward commented Jun 10, 2024

It's a trifle more complex than the docs say. Operators exist as functions in sqlalchemy.sql.operators and as methods of sqlalchemy.sql.operators.ColumnOperators, and the names aren't quite consistent. Some of the module-level functions end with _op, and some don't.

Here's what I found out experimentally. First, module-level functions:

old name new name
isfalse is_false
isnot_distinct_from is_not_distinct_from
istrue is_true
notbetween_op not_between_op
notcontains_op not_contains_op
notendswith_op not_endswith_op
notilike_op not_ilike_op
notlike_op not_like_op
notmatch_op not_match_op
notstartswith_op not_startswith_op
nullsfirst_op nulls_first_op
nullslast_op nulls_last_op
isnot is_not
notin_op not_in_op

And methods of class ColumnOperators:

old name new name
isnot_distinct_from is_not_distinct_from
notilike not_ilike
notlike not_like
nullsfirst nulls_first
nullslast nulls_last
isnot is_not
notin_ not_in

PR coming shortly...

gward added a commit to gward/sqlalchemy-stubs that referenced this issue Jun 10, 2024
gward added a commit to gward/sqlalchemy-stubs that referenced this issue Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants