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
include options, to be default in 0.8, for literal_binds=True for --sql mode #255
Comments
Michael Bayer (@zzzeek) wrote: this is probably on the SQLAlchemy side for text(). |
Wichert Akkerman (@wichert) wrote: For what it's worth the reason I tried this approach is that
Rambling on a bit: reading documentation I could not see the relation between alembic.ddl.impl.text() and sqlalchemy.text(), especially because the example for alembic.ddl.impl.text uses sqlalchemy.text. I was also wondering why the example there uses a connection connection object, when that isn't something that is generally available/used in an alembic migration context.migrations. Perhaps that documentation was copied over from SQLAlchemy? That would also explain why it says the bindparams argument has been deprecated since 0.9.0 when alembic is only up to version 0.7.2. |
Michael Bayer (@zzzeek) wrote: yeah it's quite simple that is an |
Michael Bayer (@zzzeek) wrote: so the code is
and sphinx says:
and:
so, I don't know wtf this is about. |
Michael Bayer (@zzzeek) wrote: and it is not generating on a local build. which means....read the docs is on a stale version of sphinx? That seems very hard to believe, I just used some very recent features the other day on it. perhaps it installs sphinx into the build environment....that might be it |
Michael Bayer (@zzzeek) wrote: ok doing a wipe + rebuild there, for this one, text() works on SQLA, and I'm still trying to remember if the issue of alembic setting literal_binds for sql mode exists somewhere, because at the moment it's not doing it at all. |
Michael Bayer (@zzzeek) wrote: I'm pretty sure that the alembic docs so far have recommended that you don't use actual bound parameters...e.g. if you were using insert() constructs, we tell you to use bulk_insert(), as well as I think we probably should have literal_bindparam turned on for --sql, and I think when alembic was first developed we didn't really have literal_bindparam going on at that time. So at the moment I'm not comfortable flipping it on unconditionally in the 0.7 series, it'll have to be an option that we'd probably default to True in 0.8. the flag needs to have its effect right here: https://bitbucket.org/zzzeek/alembic/src/082a6c63668a601c0833c99b4ca23fe9459a3a40/alembic/ddl/impl.py?at=master#cl-99 as for the readthedocs build, their stuff is not working and I am very annoyed so I'm going to bug them now. |
Changes by Michael Bayer (@zzzeek):
|
Changes by Michael Bayer (@zzzeek):
|
Changes by Michael Bayer (@zzzeek):
|
Michael Bayer (@zzzeek) wrote: OK docs are fixed, was a SQLAlchemy issue in 0.9 |
Michael Bayer (@zzzeek) wrote:
→ 0e1c098 |
Changes by Michael Bayer (@zzzeek):
|
Michael Bayer (@zzzeek) wrote: OK so, this is just a runtime env.py flag, so it's not that big a deal to add it into the template for new migration environments. You'll need to add it to your own env.py. here's a migration:
when i run without the changeset:
when I run with it:
this requires that you add literal_binds=True to your offline environment:
this flag is added to the env.py files for new environments as well. |
Migrated issue, originally created by Wichert Akkerman (@wichert)
I have a very simple migration:
When running that with
alembic upgrade head --sql
the bind parameter is not substituted in the generated SQL:The text was updated successfully, but these errors were encountered: