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

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

Comments

Projects
None yet
1 participant
@sqlalchemy-bot

sqlalchemy-bot commented Mar 8, 2014

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.

@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Mar 8, 2014

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 #179

6cc9c97

@sqlalchemy-bot

This comment has been minimized.

sqlalchemy-bot commented Mar 8, 2014

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