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

CreateView ignores bindparam #21

Open
rectalogic opened this issue Sep 22, 2021 · 0 comments
Open

CreateView ignores bindparam #21

rectalogic opened this issue Sep 22, 2021 · 0 comments

Comments

@rectalogic
Copy link

If I use a bindparam in my view definition, it does not appear to be bound when creating the view. Is there a way to pass through bindparams?

>>> import sqlalchemy as sa
>>> from sqlalchemy_views import CreateView
>>> engine = sa.create_engine("postgresql:///?service=devrds")
>>> table = sa.Table("my_table", sa.MetaData(), sa.Column("col", sa.String(100), nullable=True))
>>> view = sa.table("my_view")
>>> definition = table.select().where(table.c.col == sa.bindparam("colval"))
>>> create_view = CreateView(view, definition)
>>> table.create(engine)
>>> engine.execute(create_view, colval="test")
/site/venv/lib/python3.8/site-packages/sqlalchemy_views/views.py:72: SAWarning: Bound parameter 'colval' rendering literal NULL in a SQL expression; comparisons to NULL should not use operators outside of 'is' or 'is not' (this warning may be suppressed after 10 occurrences)
  text += "AS %s\n\n" % compiler.sql_compiler.process(create.selectable,
<sqlalchemy.engine.cursor.LegacyCursorResult object at 0x7fdfcd4545b0>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant