Thanks Michael! That did the trick. On Saturday, August 29, 2015 at 8:31:05 AM UTC-7, Michael Bayer wrote: > > > > On 8/29/15 7:13 AM, Martin Marrese wrote: > > > On Fri, Aug 28, 2015 at 8:16 PM, <ma...@tokbox.com <javascript:>> wrote: > >> Hi, >> >> I am trying to generate sql scripts in offline mode. But when executing >> the delete in the following manner: >> >> op.execute( >> foo.delete().where(foo.c.key == 'bar') >> ) >> >> >> generates sql as >> >> DELETE FROM foo WHERE foo.`key` = %s; >> >> >> >> How can i get the actual value 'bar' instead of %s? Is there a better way >> to do this ? If I use raw sql statements I can get around the problem >> although I am trying my best to not execute raw sql statements in there. >> > That is ok, %s is later replaced with 'bar'. > > For instance, this is the log I get when querying a table named role > filtering by id. The python code is : > > role = session.query(model.Role).get(id_) > > > for --sql mode you can add the literal_binds flag to your environment > which will attempt to render those inline: > > > http://alembic.readthedocs.org/en/latest/api/runtime.html?highlight=literal_binds#alembic.runtime.environment.EnvironmentContext.configure.params.literal_binds > > otherwise you can specify literal values using the inline_literal() > construct: > http://alembic.readthedocs.org/en/latest/ops.html?highlight=inline_literal#alembic.operations.Operations.inline_literal > > > > And the log entries are : > > 2015-08-29 08:01:53,461 INFO sqlalchemy.engine.base.Engine SELECT role.id > AS role_id, role.name AS role_name, role.is_admin AS role_is_admin > FROM role > WHERE role.id = %s > 2015-08-29 08:01:53,462 INFO sqlalchemy.engine.base.Engine (2L,) > > The first line shows the query to be executed with %s as place holder for > the parameters. The second line shows the parameters that will replace each > %s. > > Martín > > -- > > Martín > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy-alembic" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sqlalchemy-alembic+unsubscr...@googlegroups.com <javascript:>. > For more options, visit https://groups.google.com/d/optout. > > >
-- You received this message because you are subscribed to the Google Groups "sqlalchemy-alembic" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy-alembic+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.