Skip to content

Commit

Permalink
Test without sqlalchemy-citext
Browse files Browse the repository at this point in the history
The last sqlalchemy-citext update was in 2021 and it has various
compatibility issues.

SQLAlchemy now has CITEXT support.
  • Loading branch information
cjmayo committed Oct 14, 2024
1 parent 0a34141 commit 527daea
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
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 @@ -37,7 +37,6 @@ sqlalchemy = [
sqlalchemy-with-utils = [
"Flask-Admin[sqlalchemy]",
"sqlalchemy_utils>=0.38.0",
"sqlalchemy-citext>=1.8.0",
"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

0 comments on commit 527daea

Please sign in to comment.