Re:Ask HN: What technologies did you learn in 2018?
by rmdashrfstar on Monday December 24, 2018 @09:49AM
(#18752346)
Do you have an example of where you’ve found writing raw SQL queries was more efficient in both time spent programming and time spent executing the query?
I built an API in Python and SQLALchemy. Originally, it was built in Flask and Flask-SQLALchemy, but I eventually decided to migrate it to Falcon + SQLService and saw greatly improved response times from my API (hosted on AWS Lambda). Am I likely to see as significant improvements from a switch to Rust + raw SQL queries?
I am kindly looking for a reason to learn Rust. :) With the recent improvements to AWS Lambda, a Rust run-time is a reality and I am open to migrating the project once again for any additional speed improvements.
Re:Ask HN: What technologies did you learn in 2018?
by steamer25 on Sunday December 23, 2018 @11:10PM
(#18750268)
> Evidently, the costs associated with using an orm are greater than the benefits for someone who is fluent in SQL.
I largely agree although I've recently discovered the beauty of re-usable, type-checked sub-clauses by composing C# lambda expressions for Entity Framework using e.g., AndAlso():
Re:Ask HN: What technologies did you learn in 2018?
by ralala on Sunday December 23, 2018 @06:03PM
(#18748990)
how are you building dynamic queries without a query builder? (for example creating a complex where condition based on given GET parameters)
Re:Ask HN: What technologies did you learn in 2018?
by Dowwie on Sunday December 23, 2018 @06:59PM
(#18749268)
You could answer this question for your Python work if you refactor one of your dynamic queries to SQL Alchemy's query binding facility. You're working with a query string so you manipulate the string using whatever tools are available in the language. Lots of possible approaches in Python. Same for Rust.
I am trying to create a scalable platform. Without having best practices to learn from, I had to discover what that required while trying to make the most of Rust. The discovery process involves many iterations of trying approaches out until a decent one emerges.
On the other hand, once I laid the tracks down, I found my usual hindrances to productivity: business logic and data modeling.
I am much more productive with Rust and raw SQL parameter binding than Python with SQLAlchemy query builder. Evidently, the costs associated with using an orm are greater than the benefits for someone who is fluent in SQL. Learning a dsl and then fighting the dsl and then asking for help repeatedly, just to accomplish the same task and no more, is a really bad use of time.