I am using peewee, and I found that when querying a piece of data, I use the get method. If there is no matching data in the database, a DoesNotExist error will be thrown directly. I really can't stand this kind of framework that throws errors at every turn. Because I wrote a global error capture, I always automatically enter the global error capture method. You have to be forced to manually write try to nest. Sometimes there are too many queries and you have to nest several levels of try.
I just want to ask, is there any ORM framework like Java or C# that returns null if the query cannot find the result? Is it possible to encapsulate it yourself?
PHPz2017-05-18 10:59:01
# SQLAlchemy
city = sesion.query(User.city).filter(User.name=="Hello").one()
If city is null, and this query returns None (null) instead of throwing an exception, does this record exist or not?