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

TypeError: not enough arguments for format string (1.16.0) #177

Open
dnmurray opened this issue Nov 6, 2024 · 2 comments
Open

TypeError: not enough arguments for format string (1.16.0) #177

dnmurray opened this issue Nov 6, 2024 · 2 comments

Comments

@dnmurray
Copy link

dnmurray commented Nov 6, 2024

Hi, after upgrading to pytds 1.16.0 on python 3.9.18 I am getting "not enough arguments for format string" errors on any SQL statement that contains a '%' anywhere in the text (e.g. LIKE '%@%').

File "/usr/local/lib/python3.9/site-packages/pytds/cursor.py", line 322, in execute
    self._session.execute(operation, params)
File "/usr/local/lib/python3.9/site-packages/pytds/tds_session.py", line 884, in execute
    operation = operation % tuple(names)
TypeError: not enough arguments for format string                                                               

I'm stuck on 3.9 for...reasons. Not sure if that's part of the problem. Reverting to [email protected] fixes the problem.

@alex-peasley
Copy link

We have also experienced this with python 3.11.7.
Any query with a LIKE statement and a % wildcard fails on pytds version 1.16.0

@denisenkom
Copy link
Owner

If you have % in your query and query has parameters you need to escape % it by doubling it, e.g.: LIKE '%%@%%'
If your query does not have parameters you don't need to escape %

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

3 participants