←back to thread

620 points tambourine_man | 4 comments | | HN request time: 0.917s | source
Show context
TekMol ◴[] No.43749608[source]
Will this allow neat SQL syntax like the following?

    city = 'London'
    min_age = 21
    # Find all users in London who are 21 or older:
    users = db.get(t'
        SELECT * FROM users
        WHERE city={city} AND age>{min_age}
    ')
If the db.get() function accepts a template, it should, right?

This would be the nicest way to use SQL I have seen yet.

replies(8): >>43749674 #>>43749734 #>>43749906 #>>43749926 #>>43749979 #>>43750037 #>>43751845 #>>43756963 #
1. neonsunset ◴[] No.43749979[source]
> This would be the nicest way to use SQL I have seen yet.

EF/EF Core has existed for years :)

https://learn.microsoft.com/en-us/ef/core/querying/sql-queri...

replies(1): >>43750055 #
2. nurettin ◴[] No.43750055[source]
I've used it for years. In order to generate the models you had to use the visual designer which was slow and buggy.

Generally annoying experience if you have to clock in and out every day to watch that UI break your database relations whenever you click save.

replies(1): >>43750110 #
3. neonsunset ◴[] No.43750110[source]
No one uses it today, or in the last 5 years or so I presume. You use https://learn.microsoft.com/en-us/ef/core/modeling/#use-data...

This was a completely separate, legacy extension of VS, not EF let alone EF Core.

replies(1): >>43751470 #
4. nurettin ◴[] No.43751470{3}[source]
Completely separate is pushing it since it was recommended by Microsoft, but yes, I am old and times have changed.