Hosna Qasmei
Hosna Qasmei•7mo ago

How do you call a function from a sub file in python

I'm trying to query data from a function. here is my python query
projectsPerUser = client.query("plans.queries:getAllUserPlansWithUserId",{"userId": "user_2gQVIas5FGv9KaLZYCBrVWuXq7Z"})
projectsPerUser = client.query("plans.queries:getAllUserPlansWithUserId",{"userId": "user_2gQVIas5FGv9KaLZYCBrVWuXq7Z"})
Attached a photo of my folder structure and get this error. Don't think my above code is right, or is this possible to do in python?
No description
No description
9 Replies
ballingt
ballingt•7mo ago
Yep the syntax is different @Hosna Qasmei, it's "plans/queries:getAll..."
Hosna Qasmei
Hosna QasmeiOP•7mo ago
Ah I was missing the / 😭 Thank you Tom!! Live saver
ballingt
ballingt•7mo ago
we should add an error message helper that notices this and put an example in the docstring
Hosna Qasmei
Hosna QasmeiOP•7mo ago
Yeah I couldn’t find it anywhere for that case
Hosna Qasmei
Hosna QasmeiOP•7mo ago
Adding it here would be nice too https://pypi.org/project/convex/
PyPI
convex
Python client for the reactive backend-as-a-service Convex.
Hosna Qasmei
Hosna QasmeiOP•7mo ago
No description
Hosna Qasmei
Hosna QasmeiOP•7mo ago
now im getting a validation error 😅 , in typescript I just do an
as Id<"users">
as Id<"users">
or something. do i need to do that with python too?
lee
lee•7mo ago
i don't think that user id is a valid v.id("users"), which would refer to the _id field of the users table and is generated by convex. what is the type of the userId field on plans?
Hosna Qasmei
Hosna QasmeiOP•7mo ago
ah yes, didnt think to check their that was it. Had
v.id("users")
v.id("users")
when it should just been
v.string()
v.string()
that you now it's working

Did you find this page helpful?