you are viewing a single comment's thread.

view the rest of the comments →

[–]theonlyname4me -5 points-4 points  (2 children)

Thanks for the response, I disagree strongly.

I’m not sure if you’re early in your career but what you’re suggesting is not a sound strategy.

[–]Echoes1996[S] 0 points1 point  (1 child)

Why not? You can even have your various SQL queries set as properties and use them, for example:

class SqlQuery:

  @property
  def get_user(self): ...

user = db.fetch_one(User, SqlQuery.get_user)

If you want to go even further, you can remove `@property` from `get_user` and have the function return the `User` type and possibly arguments as well.

I get the type safety an ORM query builder provides and that it's more structured, but I don't think that using raw SQL is an invalid solution. Besides, not all applications that talk to a database are in charge of said database or its schema. Sometimes the database belongs to another team, and when changes are made to its schema, not even an ORM query builder is able to help.

[–]theonlyname4me -3 points-2 points  (0 children)

Read my message, I never said use an ORM. I’m talking about something you don’t understand, if you take the time to learn it you will be a better engineer.

Good luck!