Fetch table values using alembic and update to another table.

前端 未结 3 750
广开言路
广开言路 2021-02-07 00:43

I have oauth secret and oauth key in client table. Now I moving them to oauth credentials table which will be created during

3条回答
  •  遥遥无期
    2021-02-07 01:27

    Maybe try adding a column_reflect listener? E.g.:

    def listen_for_reflect(inspector, table, column_info):
        "correct an ENUM type"
        if column_info['name'] == 'my_enum':
            column_info['type'] = Enum('a', 'b', 'c')
    
    with self.op.batch_alter_table(
        "bar",
        reflect_kwargs=dict(
            listeners=[
                ('column_reflect', listen_for_reflect)
            ]
        )
    ) as batch_op:
        batch_op.alter_column(
            'flag', new_column_name='bflag', existing_type=Boolean)
    

    More info: https://alembic.zzzcomputing.com/en/latest/batch.html#controlling-table-reflection

提交回复
热议问题