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

Test without sqlalchemy-citext #2518

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Fixes:

* Jinja templates can now be loaded in StrictUndefined mode.
* Remove an implicit dependency on `packaging`
* Remove `sqlalchemy-citext1 from the optional dependencies. CITEXT supported by SQLAlchemy since 2.0.19.

2.0.0a2
-------
Expand Down
8 changes: 6 additions & 2 deletions flask_admin/tests/sqla/test_postgres.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
from citext import CIText
try:
from citext import CIText as CITEXT
except ImportError:
# SQLAlchemy >= 2.0.7, although there is an issue until 2.0.19
from sqlalchemy.dialects.postgresql import CITEXT # type: ignore[attr-defined]
from sqlalchemy import text
from sqlalchemy.dialects.postgresql import HSTORE
from sqlalchemy.dialects.postgresql import JSON
Expand Down Expand Up @@ -94,7 +98,7 @@ class CITextModel(postgres_db.Model):
id = postgres_db.Column(
postgres_db.Integer, primary_key=True, autoincrement=True
)
citext_test = postgres_db.Column(CIText)
citext_test = postgres_db.Column(CITEXT)

with postgres_db.engine.begin() as connection:
connection.execute(text("CREATE EXTENSION IF NOT EXISTS citext"))
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ sqlalchemy = [
sqlalchemy-with-utils = [
"Flask-Admin[sqlalchemy]",
"sqlalchemy_utils>=0.38.0",
"sqlalchemy-citext>=1.8.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've had a bit more of a think about this since my last comment - sorry.

We still theoretically support sqlalchemy<2.0.19 - this feels like it would break users on SQLAlchemy v1 and I'm not sure we've made the decision to drop support for that yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks more complicated because sqlalchemy-citext has not been updated for 3 years:

mahmoudimus/sqlalchemy-citext#23

mahmoudimus/sqlalchemy-citext#25

mahmoudimus/sqlalchemy-citext#26

I don't know whether it is possible to get away with it (if using psycopg2), our simple test passes. But ultimately this is recommending something that is broken.

"colour>=0.1.5",
"email_validator>=2",
"arrow>=0.13.0",
Expand Down
1 change: 1 addition & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ setenv =
AZURE_STORAGE_CONNECTION_STRING = DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;
deps =
sqlalchemy1: sqlalchemy<2
sqlalchemy1: sqlalchemy-citext
-r requirements/tests.txt
commands_pre =
noflaskbabel: pip uninstall -y flask-babel
Expand Down