def _after_create(target, conn, **kw): assert target is column.table col_func = func.indico_unaccent(func.lower(column)) index_kwargs = {} if not current_app.config['TESTING'] and has_extension(conn, 'pg_trgm'): index_kwargs = {'postgresql_using': 'gin', 'postgresql_ops': {col_func.key: 'gin_trgm_ops'}} elif not current_app.config['TESTING']: print 'Warning: pg_trgm extension is not available' Index(conv('ix_{}_{}_unaccent'.format(column.table.name, column.name)), col_func, **index_kwargs).create(conn)
def _after_create(target, conn, **kw): assert target is column.table col_func = func.indico.indico_unaccent(func.lower(column)) index_kwargs = { 'postgresql_using': 'gin', 'postgresql_ops': { col_func.key: 'gin_trgm_ops' } } Index(conv(f'ix_{column.table.name}_{column.name}_unaccent'), col_func, **index_kwargs).create(conn)
def _after_create(target, conn, **kw): assert target is column.table col_func = func.indico_unaccent(func.lower(column)) index_kwargs = {} if not current_app.config['TESTING'] and has_extension( conn, 'pg_trgm'): index_kwargs = { 'postgresql_using': 'gin', 'postgresql_ops': { col_func.key: 'gin_trgm_ops' } } elif not current_app.config['TESTING']: print 'Warning: pg_trgm extension is not available' Index(conv('ix_{}_{}_unaccent'.format(column.table.name, column.name)), col_func, **index_kwargs).create(conn)
def f(self, name: str) -> "conv": """Indicate a string name that has already had a naming convention applied to it. This feature combines with the SQLAlchemy ``naming_convention`` feature to disambiguate constraint names that have already had naming conventions applied to them, versus those that have not. This is necessary in the case that the ``"%(constraint_name)s"`` token is used within a naming convention, so that it can be identified that this particular name should remain fixed. If the :meth:`.Operations.f` is used on a constraint, the naming convention will not take effect:: op.add_column('t', 'x', Boolean(name=op.f('ck_bool_t_x'))) Above, the CHECK constraint generated will have the name ``ck_bool_t_x`` regardless of whether or not a naming convention is in use. Alternatively, if a naming convention is in use, and 'f' is not used, names will be converted along conventions. If the ``target_metadata`` contains the naming convention ``{"ck": "ck_bool_%(table_name)s_%(constraint_name)s"}``, then the output of the following: op.add_column('t', 'x', Boolean(name='x')) will be:: CONSTRAINT ck_bool_t_x CHECK (x in (1, 0))) The function is rendered in the output of autogenerate when a particular constraint name is already converted. """ return conv(name)
def _after_create(target, conn, **kw): assert target is column.table col_func = func.indico.indico_unaccent(func.lower(column)) index_kwargs = {'postgresql_using': 'gin', 'postgresql_ops': {col_func.key: 'gin_trgm_ops'}} Index(conv('ix_{}_{}_unaccent'.format(column.table.name, column.name)), col_func, **index_kwargs).create(conn)