Alembic bulk_insert to table with schema

余生颓废 提交于 2020-01-04 17:30:33

问题


I'm looking at the example at bulk_insert.

# Create an ad-hoc table to use for the insert statement.
accounts_table = table('account',
    column('id', Integer),
    column('name', String),
    column('create_date', Date)
)

I would like to bulk insert to a specific schema called kpi but I can't figure out how to do it. Can someone help me out?


回答1:


The answer I've found so far is to use the sqlalchemy function instead like below:

accounts_table = sa.Table('accounts_table', sa.MetaData(),
    sa.Column('id', sa.Integer),
    sa.Column('name', sa.String(100)),
    sa.Column('create_date', sa.Date),
    schema='phone'
)


来源:https://stackoverflow.com/questions/20379878/alembic-bulk-insert-to-table-with-schema

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!