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

The number of supplied parameters does not match the expected number of parameters #62

Open
jamesmf opened this issue Aug 15, 2018 · 0 comments

Comments

@jamesmf
Copy link

jamesmf commented Aug 15, 2018

I have a query that defines a CTE and joins two subqueries from that CTE. The CTE itself has 3 bind parameters in this instance. The subqueries each have 4. That's a total of 11 bind parameters in the query, and when I compile it, I see 11 ?s.

When I try to run it, I get the error ('PARAMS_MISMATCH', 'The number of supplied parameters (11) does not match the expected number of parameters (14).')

I'm assuming that this has to do with the fact that there are 3 bind parameters in the CTE (and that's why it's off by 3).

My temporary workaround is to just compile the statement with literal_binds and execute it that way.

Any idea if this is an issue with sqlalchemy-teradata or tdodbc?

minimal example:

import sqlalchemy as sa
dd = sa.table('some_table', sa.column('date_dim'))
mycte = dd.select().where(dd.c.date_dim == 100).cte('mycte')
sub1 = mycte.select().where(mycte.c.date_dim == 100).alias('sub1')
sub2 = mycte.select().where(mycte.c.date_dim == 200).alias('sub2')
join = sub1.join(sub2, sub1.c.date_dim == sub2.c.date_dim).select()

This would produce (if you had a table called some_table with a column date_dim) an error stating that you supplied 3 parameters but you expected 4.

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