Registry / database / sqlalchemy-citext

sqlalchemy-citext

JSON →
library1.8.0pypypiunverified

A SQLAlchemy plugin that provides CITEXT (case-insensitive text) support for PostgreSQL. The latest version is 1.8.0, with infrequent releases as needed.

pip install sqlalchemy-citext
INSTALL
IMPORT
SIG · SQLALCHEMY-CITEXT
S
sqlalchemy-citext
databasepythonv1.8.0
Install
4.3s avg
Import
Disk
42MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.8.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 44.3MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 4.3s · import 0.000s · 42MB
42MB installed
● package 42MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

CIText
from citext import CIText
from sqlalchemy_citext import CIText

Example using CIText with SQLAlchemy ORM.

from sqlalchemy import create_engine, Column, Integer, String from sqlalchemy.ext.declarative import declarative_base from sqlalchemy_citext import CIText Base = declarative_base() class User(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True) name = Column(CIText) engine = create_engine('postgresql://user:pass@localhost/db') Base.metadata.create_all(engine) # Insert and query case-insensitively from sqlalchemy.orm import sessionmaker Session = sessionmaker(bind=engine) session = Session() session.add(User(name='Alice')) session.commit() user = session.query(User).filter(User.name == 'alice').first() # works print(user.name) # Alice
Debug
Known issues
gotchaCIText creates a custom PostgreSQL type 'citext' on first use. Ensure the user has permissions to CREATE TYPE in the public schema.
fix
Grant CREATE ON SCHEMA public TO your_user; or create the type manually before using CIText.
affects: >=1.0
deprecatedThe import `from sqlalchemy_citext import CIText` is preferred. Older code may use `from citext import CIText` which is deprecated.
fix
Use `from sqlalchemy_citext import CIText`.
affects: <1.0
gotchaCIText only works with PostgreSQL. Attempting to use it with other databases (like SQLite) will cause errors.
fix
Ensure your database URL points to a PostgreSQL instance.
affects: all
Upgrade
Version history
1.8.0latest on PyPI · released Mar 2, 2021
Audit
Dependencies
sqlalchemyrequiredCore dependency for database interaction
psycopg2-binaryoptionalPostgreSQL driver
Agent activity
15 hits · last 30 days
node
10
Meta
2
OpenAI (training)
1
Resources
sqlalchemy-citext — pip install sqlalchemy-citext · libregistry