sqlalchemy-citext
=================
Creates a SQLAlchemy user defined type to understand
`PostgreSQL's CIText <http://www.postgresql.org/docs/9.1/static/citext.html>`_
extension.
Installation
------------
This requires some kind of PostgreSQL compatible db-api driver already
installed in order to work.
Make sure you have something like ``psycopg2`` already installed.
.. code-block:: console
pip install sqlalchemy-citext
Usage
-----
.. code-block:: python
from sqlalchemy import create_engine, MetaData, Integer
from sqlalchemy.schema import Column, Table
import sqlalchemy.orm as orm
from citext import CIText
engine = create_engine('postgresql://localhost/test_db')
meta = MetaData()
test_table = Table('test', meta,
Column('id', Integer(), primary_key=True),
Column('txt', CIText()))
conn = engine.connect()
meta.bind = conn
meta.drop_all()
meta.create_all()
class TestObj(object):
def __init__(self, id_, txt):
self.id = id_
self.txt = txt
def __repr__(self):
return "TestObj(%r, %r)" % (self.id, self.txt)
orm.mapper(TestObj, test_table)
Session = orm.sessionmaker(bind=engine)
ses = Session()
to = TestObj(1, txt='FooFighter')
ses.add(to)
ses.commit()
row = ses.query(TestObj).filter(TestObj.txt == 'foofighter').all()
assert len(row) == 1
print row
ses.close()
License
-------
``sqlalchemy-citext`` is an MIT/BSD dual-Licensed library.
Contribute
----------
- Check for open issues or open a fresh issue to start a discussion around a
feature idea or a bug.
- Fork the repository on GitHub to start making your changes to the master
branch (or branch off of it).
- Write a test which shows that the bug was fixed or that the feature
works as expected.
- Send a pull request and bug the maintainer until it gets merged and
published.
- Make sure to add yourself to the author's file in ``setup.py`` and the
``Contributors`` section below :)
Contributors
------------
- `@mahmoudimus <https://github.com/mahmoudimus>`_
- `@vad <https://github.com/vad>`_
- `@dstufft <https://github.com/dstufft>`_
- `@brmzkw <https://github.com/brmzkw>`_
- `@graingert <https://github.com/graingert>`_
- `@cjmayo <https://github.com/cjmayo>`_
- `@libre-man <https://github.com/libre-man>`_
Raw data
{
"_id": null,
"home_page": "https://github.com/mahmoudimus/sqlalchemy-citext",
"name": "sqlalchemy-citext",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Mahmoud Abdelkader, Davide Setti",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/1a/c3/404caceaffdf0dcfa822e8b068aebc4fef328bf85af42b6cd8fdd2b2555b/sqlalchemy-citext-1.8.0.tar.gz",
"platform": "",
"description": "sqlalchemy-citext\n=================\n\nCreates a SQLAlchemy user defined type to understand\n`PostgreSQL's CIText <http://www.postgresql.org/docs/9.1/static/citext.html>`_\nextension.\n\nInstallation\n------------\n\nThis requires some kind of PostgreSQL compatible db-api driver already\ninstalled in order to work.\n\nMake sure you have something like ``psycopg2`` already installed.\n\n.. code-block:: console\n\n pip install sqlalchemy-citext\n\nUsage\n-----\n\n.. code-block:: python\n\n from sqlalchemy import create_engine, MetaData, Integer\n from sqlalchemy.schema import Column, Table\n import sqlalchemy.orm as orm\n\n from citext import CIText\n\n\n engine = create_engine('postgresql://localhost/test_db')\n meta = MetaData()\n\n test_table = Table('test', meta,\n Column('id', Integer(), primary_key=True),\n Column('txt', CIText()))\n\n conn = engine.connect()\n\n meta.bind = conn\n meta.drop_all()\n meta.create_all()\n\n class TestObj(object):\n def __init__(self, id_, txt):\n self.id = id_\n self.txt = txt\n\n def __repr__(self):\n return \"TestObj(%r, %r)\" % (self.id, self.txt)\n\n orm.mapper(TestObj, test_table)\n Session = orm.sessionmaker(bind=engine)\n ses = Session()\n\n to = TestObj(1, txt='FooFighter')\n ses.add(to)\n ses.commit()\n row = ses.query(TestObj).filter(TestObj.txt == 'foofighter').all()\n assert len(row) == 1\n print row\n ses.close()\n\n\nLicense\n-------\n\n``sqlalchemy-citext`` is an MIT/BSD dual-Licensed library.\n\n\nContribute\n----------\n\n- Check for open issues or open a fresh issue to start a discussion around a\n feature idea or a bug.\n- Fork the repository on GitHub to start making your changes to the master\n branch (or branch off of it).\n- Write a test which shows that the bug was fixed or that the feature\n works as expected.\n- Send a pull request and bug the maintainer until it gets merged and\n published.\n- Make sure to add yourself to the author's file in ``setup.py`` and the\n ``Contributors`` section below :)\n\nContributors\n------------\n\n- `@mahmoudimus <https://github.com/mahmoudimus>`_\n- `@vad <https://github.com/vad>`_\n- `@dstufft <https://github.com/dstufft>`_\n- `@brmzkw <https://github.com/brmzkw>`_\n- `@graingert <https://github.com/graingert>`_\n- `@cjmayo <https://github.com/cjmayo>`_\n- `@libre-man <https://github.com/libre-man>`_\n",
"bugtrack_url": null,
"license": "BSD",
"summary": "A sqlalchemy plugin that allows postgres use of CITEXT.",
"version": "1.8.0",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1ac3404caceaffdf0dcfa822e8b068aebc4fef328bf85af42b6cd8fdd2b2555b",
"md5": "b1fbdce01c0a4a31a4d9f1317d2fb17a",
"sha256": "a1740e693a9a334e7c8f60ae731083fe75ce6c1605bb9ca6644a6f1f63b15b77"
},
"downloads": -1,
"filename": "sqlalchemy-citext-1.8.0.tar.gz",
"has_sig": false,
"md5_digest": "b1fbdce01c0a4a31a4d9f1317d2fb17a",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 3601,
"upload_time": "2021-03-02T18:14:03",
"upload_time_iso_8601": "2021-03-02T18:14:03.539081Z",
"url": "https://files.pythonhosted.org/packages/1a/c3/404caceaffdf0dcfa822e8b068aebc4fef328bf85af42b6cd8fdd2b2555b/sqlalchemy-citext-1.8.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2021-03-02 18:14:03",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "mahmoudimus",
"github_project": "sqlalchemy-citext",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "SQLAlchemy",
"specs": [
[
">=",
"0.6"
]
]
}
],
"lcname": "sqlalchemy-citext"
}