Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inline_literal is being squashed by op.bulk_insert() #179

sqlalchemy-bot opened this issue Mar 8, 2014 · 2 comments

inline_literal is being squashed by op.bulk_insert() #179

sqlalchemy-bot opened this issue Mar 8, 2014 · 2 comments


Copy link

Migrated issue, originally created by Michael Bayer (@zzzeek)

from alembic.migration import MigrationContext
from alembic.operations import Operations
from sqlalchemy import create_engine, literal_column
from sqlalchemy.sql import table, column
import sqlalchemy as sa

engine = create_engine("mysql://")

ctx = MigrationContext.configure(engine, opts=dict(as_sql=True))
op = Operations(ctx)

test = table('test',
               column('id', sa.Integer),
               column('date', sa.Date)

op.bulk_insert(test, [
                       {'id': 1,
                        'date': op.inline_literal('2014-01-01', type_=sa.String),

it's wrapping the _literal_bindparam inside of another one.

Copy link

Michael Bayer (@zzzeek) wrote:

  • Fixed bug where :meth:.Operations.bulk_insert would not function
    properly when :meth:.Operations.inline_literal values were used,
    either in --sql or non-sql mode. The values will now render
    directly in --sql mode. For compatibility with "online" mode,
    a new flag :paramref:~.Operations.inline_literal.multiparams
    can be set to False which will cause each parameter set to be
    compiled and executed with individual INSERT statements.
    fixes inline_literal is being squashed by op.bulk_insert() #179


Copy link

Changes by Michael Bayer (@zzzeek):

  • changed status to closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

1 participant