Skip to content

Conversation

@martinzellner
Copy link

This PR resosolves #46. Instead of using a hardcoded nvarchar(36) as a data type, the data type of the lhs is used for the temp table. The tests still pass.

It would be cool to get this in the next release as this is rather blocking for us. Let me know if you have any questions.

@mihalikv
Copy link

Hello @martinzellner, thank you for your fix. I test it on my project and it works very well. However, while using it I encourage the following problem:

import uuid

test_few_ids = [str(uuid.uuid4()) for i in range(10)]
test_few_ids.append(None) # crucial line

test_lot_of_ids = [str(uuid.uuid4()) for i in range(8000)]
test_lot_of_ids.append(None) # crucial line

# return result without error
TestModel.objects.filter(pk__in=test_few_ids) 

# this raise ProgrammingError
# ProgrammingError: ('42000', '[42000] [FreeTDS][SQL Server]Conversion failed when converting from a character string to uniqueidentifier. (8169) (SQLExecDirectW)')
TestModel.objects.filter(pk__in=test_lot_of_ids)

I was able to fix the issue by fixing my code and prevent of having None in the filter array but it was hard to debug. Is it possible to somehow change the code and have the same behaviour of __in filter?

@absci absci merged commit 8940e1f into microsoft:dev Jun 17, 2021
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

Successfully merging this pull request may close these issues.

3 participants