Ask HN: Which programming language do you think offers the best support for SQL?
I find that a language as Go feels really tedious working with SQL, Java on the other end of the spectrum has many options but they feel pretty bulky. Whats your language of choice for a relatively simple CRUD app which uses SQL?
9 comments
[ 2.9 ms ] story [ 25.0 ms ] threadYou may be interested in https://hasura.io
I worked with several operating systems that included a native programming language and a built-in DBMS: DEC-MUMPS (MUMPS) and IBM OS/400 (RPG). The facilities for database queries in these languages were much better than embedded SQL.
For node we use the pg-format package to format most of our queries and then the standard pg package to execute queries. It is honestly one of the easier and cleaner ways methods I've used. I am not a big fan of ORM's and find a lot of them add way to much complexity for too little benefit, so I am a big fan of either stored procedures/functions or straight (but safe) query building.
I have written code in node.js, Go, C & C++, Java and Python to manipulate data in different sql databases and they all have some form of tedious tasks in relation to the SQL integration.
When I do need the data in object form I use what is probably an unpopular method for a lot of people, that is I build a serialize/deserialize solution (or use one already built). It isn't hard in either node.js or Go. It can add some fragility into the codebase, however, depending how it is implemented. Frankly though, I like this because essentially this is what an ORM would do too, just an ORM would be trying to build the query, guess on keys, indexes etc and then still serialize and deserialize my data, which again may not be ideal because of generic choices it has to make.
Also, a fairly common pattern for CRUD APIs is I do not need to map the returned data into an object ever, I simply need a json object to return. And at least when using postgres I can use jsonb_agg and to_jsonb to help make life really easy. MySQL has similar json functions. When doing updates the submitted json data is used to build the query so there is no need to really have things in native object form.
Hopefully that all makes sense.