1

I have this issue when I try to run upgrade on a migration that will change the type of a VARCHAR column to INTEGER and change the PK too. This is traceback:

The definition of the class is the follow:

class ActionsIntiza(Base):
    __tablename__ = 'actions_intiza'
    customer_user_id = sa.Column(sa.VARCHAR(20), nullable=False)
    customer_id = sa.Column(sa.INTEGER(), primary_key=True, info={'sortkey': True})
    intiza_action_created = sa.Column(sa.DATE(), nullable=False)
    intiza_action = sa.Column(sa.VARCHAR(50), nullable=False)
    intiza_action_type = sa.Column(sa.VARCHAR(50))
    intiza_action_tag = sa.Column(sa.VARCHAR(50))
    intiza_action_comment = sa.Column(sa.VARCHAR())
    intiza_action_attachment = sa.Column(sa.VARCHAR(50))
    moni_user_name = sa.Column(sa.VARCHAR(50))

The traceback:

Traceback (most recent call last):
    File "C:\Users\Usuario\AppData\Roaming\Python\Python38\site-packages\sqlalchemy\sql\visitors.py", line 88, in _compiler_dispatch
        meth = getter(visitor)
    AttributeError: 'RedshiftDDLCompiler' object has no attribute 'visit_clause'   
        op.alter_column('actions_intiza', 'customer_id',
    File "<string>", line 8, in alter_column
    File "<string>", line 3, in alter_column
    File "c:\users\usuario\appdata\local\programs\python\python38\lib\site-packages\alembic\operations\ops.py", line 1777, in alter_column    
      return operations.invoke(alt)
    File "c:\users\usuario\appdata\local\programs\python\python38\lib\site-packages\alembic\operations\base.py", line 345, in invoke
      return fn(self, operation)
    File "c:\users\usuario\appdata\local\programs\python\python38\lib\site-packages\alembic\operations\toimpl.py", line 43, in alter_column   
      operations.impl.alter_column(
    File "c:\users\usuario\appdata\local\programs\python\python38\lib\site-packages\alembic\ddl\postgresql.py", line 116, in alter_column     
      self._exec(
    File "c:\users\usuario\appdata\local\programs\python\python38\lib\site-packages\alembic\ddl\impl.py", line 134, in _exec
      return conn.execute(construct, *multiparams, **params)
    File "C:\Users\Usuario\AppData\Roaming\Python\Python38\site-packages\sqlalchemy\engine\base.py", line 982, in execute
      return meth(self, multiparams, params)
    File "C:\Users\Usuario\AppData\Roaming\Python\Python38\site-packages\sqlalchemy\sql\ddl.py", line 72, in _execute_on_connection
      return connection._execute_ddl(self, multiparams, params)
    File "C:\Users\Usuario\AppData\Roaming\Python\Python38\site-packages\sqlalchemy\engine\base.py", line 1033, in _execute_ddl
      compiled = ddl.compile(
    File "<string>", line 1, in <lambda>
    File "C:\Users\Usuario\AppData\Roaming\Python\Python38\site-packages\sqlalchemy\sql\elements.py", line 468, in compile
      return self._compiler(dialect, bind=bind, **kw)
    File "C:\Users\Usuario\AppData\Roaming\Python\Python38\site-packages\sqlalchemy\sql\ddl.py", line 29, in _compiler
      return dialect.ddl_compiler(dialect, self, **kw)
    File "C:\Users\Usuario\AppData\Roaming\Python\Python38\site-packages\sqlalchemy\sql\compiler.py", line 319, in __init__
      self.string = self.process(self.statement, **compile_kwargs)
    File "C:\Users\Usuario\AppData\Roaming\Python\Python38\site-packages\sqlalchemy\sql\compiler.py", line 350, in process
      return obj._compiler_dispatch(self, **kwargs)
    File "C:\Users\Usuario\AppData\Roaming\Python\Python38\site-packages\sqlalchemy\ext\compiler.py", line 436, in <lambda>
      lambda *arg, **kw: existing(*arg, **kw),
    File "C:\Users\Usuario\AppData\Roaming\Python\Python38\site-packages\sqlalchemy\ext\compiler.py", line 478, in __call__
      return fn(element, compiler, **kw)
    File "C:\Users\Usuario\AppData\Roaming\Python\Python38\site-packages\sqlalchemy\ext\compiler.py", line 425, in _wrap_existing_dispatch    
      raise exc.CompileError(
    sqlalchemy.exc.CompileError: <class 'alembic.ddl.postgresql.PostgresqlColumnType'> construct has no default compilation handler.

Can you help me?

Shiva
  • 2,627
  • 21
  • 33
Juan Almada
  • 129
  • 7

0 Answers0