TSVECTOR
is a constant within the sqlalchemy.dialects.postgresql
module of the SQLAlchemy project.
ARRAY,
BIGINT,
BIT,
DOUBLE_PRECISION,
ExcludeConstraint,
INTEGER,
JSON,
array,
json,
and pypostgresql
are several other callables with code examples from the same sqlalchemy.dialects.postgresql
package.
sqlalchemy-utils (project documentation and PyPI package information) is a code library with various helper functions and new data types that make it easier to use SQLAlchemy when building projects that involve more specific storage requirements such as currency. The wide array of data types includes ranged values and aggregated attributes.
sqlalchemy-utils / sqlalchemy_utils / types / ts_vector.py
# ts_vector.py
import sqlalchemy as sa
from sqlalchemy.dialects.postgresql import TSVECTOR
class TSVectorType(sa.types.TypeDecorator):
impl = TSVECTOR
class comparator_factory(TSVECTOR.Comparator):
def match(self, other, **kwargs):
if 'postgresql_regconfig' not in kwargs:
if 'regconfig' in self.type.options:
kwargs['postgresql_regconfig'] = (
self.type.options['regconfig']
)
return TSVECTOR.Comparator.match(self, other, **kwargs)
def __or__(self, other):
return self.op('||')(other)
def __init__(self, *args, **kwargs):
self.columns = args
self.options = kwargs
super(TSVectorType, self).__init__()
## ... source file continues with no further TSVECTOR examples...