From e210e7335db5bedbc68f4fa3ed7ea039a9fd89f1 Mon Sep 17 00:00:00 2001 From: Mohammed Kareem Date: Thu, 21 Apr 2016 00:37:27 +0200 Subject: Fixed nullsfirst, nullslast documentation error Got this error when trying to import nullslast. File "/home/kareem/projects/python/amcapi/app/models/models.py", line 25, in from sqlalchemy import nullslast ImportError: cannot import name nullslast was able to fix it by importing from sqlalchemy.sql.expression. --- lib/sqlalchemy/sql/elements.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py index 00c2c37ba..3f6ac6c2f 100644 --- a/lib/sqlalchemy/sql/elements.py +++ b/lib/sqlalchemy/sql/elements.py @@ -2536,7 +2536,7 @@ class UnaryExpression(ColumnElement): should be handled when they are encountered during ordering:: - from sqlalchemy import desc, nullsfirst + from sqlalchemy.sql.expression import desc, nullsfirst stmt = select([users_table]).\\ order_by(nullsfirst(desc(users_table.c.name))) @@ -2579,7 +2579,7 @@ class UnaryExpression(ColumnElement): should be handled when they are encountered during ordering:: - from sqlalchemy import desc, nullslast + from sqlalchemy.sql.expression import desc, nullslast stmt = select([users_table]).\\ order_by(nullslast(desc(users_table.c.name))) -- cgit v1.2.1