diff --git a/CHANGES.rst b/CHANGES.rst index 4b5c7cc..da8401d 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,6 +4,12 @@ Changelog Here you can see the full list of changes between each SQLAlchemy-Utils release. +0.16.22 (2013-10-03) +^^^^^^^^^^^^^^^^^^^^ + +- Added optional columns and options parameter for TSVectorType + + 0.16.21 (2013-09-29) ^^^^^^^^^^^^^^^^^^^^ diff --git a/setup.py b/setup.py index da92265..56ad9e6 100644 --- a/setup.py +++ b/setup.py @@ -56,7 +56,7 @@ for name, requirements in extras_require.items(): setup( name='SQLAlchemy-Utils', - version='0.16.21', + version='0.16.22', url='https://github.com/kvesteri/sqlalchemy-utils', license='BSD', author='Konsta Vesterinen, Ryan Leckey, Janne Vanhala, Vesa Uimonen', diff --git a/sqlalchemy_utils/__init__.py b/sqlalchemy_utils/__init__.py index 8b96861..e7706f2 100644 --- a/sqlalchemy_utils/__init__.py +++ b/sqlalchemy_utils/__init__.py @@ -38,7 +38,7 @@ from .types import ( ) -__version__ = '0.16.21' +__version__ = '0.16.22' __all__ = ( diff --git a/sqlalchemy_utils/types/ts_vector.py b/sqlalchemy_utils/types/ts_vector.py index 4d09aa8..b662cd4 100644 --- a/sqlalchemy_utils/types/ts_vector.py +++ b/sqlalchemy_utils/types/ts_vector.py @@ -3,6 +3,16 @@ from sqlalchemy.dialects.postgresql.base import ischema_names class TSVectorType(sa.types.UserDefinedType): + def __init__(self, *args, **kwargs): + """ + Initializes new TSVectorType + + :param *args: list of column names + :param **kwargs: various other options for this TSVectorType + """ + self.columns = args + self.options = kwargs + """ Text search vector type for postgresql. """ diff --git a/tests/types/test_tsvector.py b/tests/types/test_tsvector.py index cfcfbb6..707b2e1 100644 --- a/tests/types/test_tsvector.py +++ b/tests/types/test_tsvector.py @@ -30,3 +30,8 @@ class TestTSVector(TestCase): autoload_with=self.engine ) assert isinstance(table.c['search_index'].type, TSVectorType) + + def test_catalog_and_columns_as_args(self): + type_ = TSVectorType('name', 'age', catalog='pg_catalog.simple') + assert type_.columns == ('name', 'age') + assert type_.options['catalog'] == 'pg_catalog.simple'