我们从Python开源项目中,提取了以下29个代码示例,用于说明如何使用sqlalchemy.dialects.postgresql.TSVECTOR。
def visit_TSVECTOR(self, type, **kw): return "TSVECTOR"
def serialize_columns(cls, obj, data, skip_primary_key=False, skip_foreign_keys=False): columns = inspect(obj).mapper.columns for key, column in columns.items(): if skip_primary_key and column.primary_key: continue if skip_foreign_keys and len(column.foreign_keys): continue if isinstance(column.type, TSVECTOR): continue data[key] = cls.serialize_column(column, getattr(obj, key)) return data
def get_schema(self, objects_class): extended_mapping = alchemyjsonschema.default_column_to_schema.copy() extended_mapping[sqltypes.ARRAY] = 'array' extended_mapping[sqltypes.JSON] = 'object' extended_mapping[TSVECTOR] = 'array' factory = alchemyjsonschema.SchemaFactory(alchemyjsonschema.StructuralWalker, classifier=alchemyjsonschema.Classifier(extended_mapping)) return factory(objects_class, depth=1)
def visit_TSVECTOR(self, type): return "TSVECTOR"
def test_type_reflection(self, engine): reflected_metadata = sa.schema.MetaData() table = sa.schema.Table( 'user', reflected_metadata, autoload=True, autoload_with=engine ) assert isinstance(table.c['search_index'].type, TSVECTOR)
def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_index('idx_priority_areas_geometry', table_name='priority_areas') op.add_column('project_info', sa.Column('project_id_str', sa.String(), nullable=True)) op.add_column('project_info', sa.Column('text_searchable', postgresql.TSVECTOR(), nullable=True)) # ### end Alembic commands ###