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

Where clause with multiple values #208

Closed
danielweil opened this issue Jan 5, 2022 · 16 comments
Closed

Where clause with multiple values #208

danielweil opened this issue Jan 5, 2022 · 16 comments
Labels
kind/question Developer asked a question. No code changes required.

Comments

@danielweil
Copy link

Hey,

Is there any way to use IN and NOT IN for normal kind of columns in the where clause?

Ex: Get the objects from the db from a list of IDs.

Sorry for opening an issue, I searched the docs but couldn't find it.

@RobertCraigie
Copy link
Owner

What do you mean by normal kind of columns?

@danielweil
Copy link
Author

Integers and strings.

@RobertCraigie
Copy link
Owner

I need to improve the structure of the documentation.

You can find the documentation for these operations here:
https://prisma-client-py.readthedocs.io/en/stable/reference/operations/#string-fields

@RobertCraigie
Copy link
Owner

May I ask where you were looking in the documentation before?

I find it difficult to know whether or not the documentation I've written is well structured so any feedback would be greatly appreciated :)

@RobertCraigie RobertCraigie added the kind/question Developer asked a question. No code changes required. label Jan 5, 2022
@danielweil
Copy link
Author

Guess it is my fault.

I passed it through the page but thought that "desc" could be ordering descenent. My Bad!

Thanks!

@RobertCraigie
Copy link
Owner

Don't worry about it, the documentation does need some work.

@RobertCraigie
Copy link
Owner

Ah I see, I should use a different field name to showcase that API.

@danielweil
Copy link
Author

Can I ask you another doubt?

I am trying to update a foreign key in my object, and I saw previously that I had to use "connect" keywork.

I was able to make it work in create clauses, but not in update. Can you help me out?

image

image

image

@RobertCraigie
Copy link
Owner

@danielweil I think this is actually a bug, let me look into it further.

@RobertCraigie
Copy link
Owner

@danielweil You can't update a relation in an update_many query.

@RobertCraigie
Copy link
Owner

prisma/prisma#3143

@danielweil
Copy link
Author

How should go on for now?

@RobertCraigie
Copy link
Owner

You could try using query batching and switch to making multiple update calls instead of one update_many: https://prisma-client-py.readthedocs.io/en/stable/reference/batching/

However, I don't know if this will work for your use case

@danielweil
Copy link
Author

Should raw queries work? I tried using it for the update and it gave me this error:

image

@RobertCraigie
Copy link
Owner

That looks like it could be a bug, Clcan you share the debug logs please?

https://prisma-client-py.readthedocs.io/en/stable/reference/logging/#debugging-the-client

@danielweil
Copy link
Author

Thanks! I could fix the problem with the message!. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/question Developer asked a question. No code changes required.
Projects
None yet
Development

No branches or pull requests

2 participants