Papa Johns
Papa Johns17mo ago

Raw query

But still wanted to know if it supports that as if the query is bit heavy and needs a lot of calculations on the db part then the raw query is best for that I think. Do correct me here if I am wrong.
15 Replies
nipunn
nipunn17mo ago
What do you mean by raw query here? Can you give an example?
Papa Johns
Papa JohnsOP17mo ago
SELECT * , --- calculating the order amount and other required parameters for that particular order
FROM order left join products on product.id = order.productId \n inner join user on user.id = order.createdBy
SELECT * , --- calculating the order amount and other required parameters for that particular order
FROM order left join products on product.id = order.productId \n inner join user on user.id = order.createdBy
something like that but it can be little big
nipunn
nipunn17mo ago
Ah like SQL. Convex doesn't support querying with sql. We’re big believers in the deterministic query function for OLTP workloads. Convex does not use sql under the hood either. We use indexes and filters and the other features of the query language Stay tuned for ergonomics on joins. It’s something that isn’t great (as you are discovering), and it’s something we are definitely thinking about
Papa Johns
Papa JohnsOP17mo ago
Yeah sure, actually I recently started using convex and I thought the implementation could be more simpler. Like if one has to make a query then - import query function - then call the function and create a object inside the function with a handle key being an async function with an query instance constant and arguments constant - then use that constant to query that data further - also if needed to filter a data as you mentioned above functional approach is used. Wouldn't using a lot . s' to query a data or to perform any crud op, wouldn't that make readability issues.
nipunn
nipunn17mo ago
Yeah. We hear you. There’s a lot of chained function calls in the query builder. Do you happen to use JS or TS?
Papa Johns
Papa JohnsOP17mo ago
Mostly JS, but switching to TS
nipunn
nipunn17mo ago
There are some great TS advantages to the query builder. Eg when using indexes But agreed on readability
Papa Johns
Papa JohnsOP17mo ago
😅
nipunn
nipunn17mo ago
Stay tuned!
Papa Johns
Papa JohnsOP17mo ago
sure.
nipunn
nipunn17mo ago
Open to suggestions too. Making a good query builder is an art. The query planner requires behind most sql impls is something we’re happy to avoid - with unexpected behavior on the oltp path
Papa Johns
Papa JohnsOP17mo ago
is the project OS like one can contribute to it right. What is the main repository that is used in production that can be used to make contributions of the testing part
Michal Srb
Michal Srb17mo ago
The JS part, both HTTP, React and simple clients, and the library that runs on the server is open source here: https://github.com/get-convex/convex-js/ You could plausibly open a PR for adding a testing harness to it. We have some work-in-progress changes in this direction internally.
GitHub
GitHub - get-convex/convex-js: TypeScript/JavaScript client library...
TypeScript/JavaScript client library for Convex. Contribute to get-convex/convex-js development by creating an account on GitHub.
Papa Johns
Papa JohnsOP17mo ago
Are there any env variables required here If I create a local instance how can I test the working and validate if everything is working fine the way it was should. @Michal Srb Thanks a lot for this information.
Michal Srb
Michal Srb17mo ago
@Papa Johns for testing your backend functions I would run an internal backend function that exercises the tested code. So basically same setup as the one you can achive with our quickstarts: https://docs.convex.dev/quickstarts
Quickstarts | Convex Developer Hub
Quickly get up and running with your favorite frontend tooling or language:

Did you find this page helpful?