home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.os.vms      DEC's VAX* line of computers & VMS.      264,096 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 262,914 of 264,096   
   =?UTF-8?Q?Arne_Vajh=C3=B8j?= to Lawrence D'Oliveiro   
   Re: VMS x86-64 database server   
   28 Jul 25 22:36:59   
   
   From: arne@vajhoej.dk   
      
   On 7/28/2025 9:07 PM, Lawrence D'Oliveiro wrote:   
   > On Mon, 28 Jul 2025 19:28:51 -0400, Arne Vajhøj wrote:   
   >> I repeat: the saving is not in the query, but in the mapping from the   
   >> query result to the object model.   
   >   
   > But I thought a key point of ORMs is hiding the SQL.   
      
   It is not.   
      
   The primary point is to save all the code mapping between   
   query result and object model.   
      
   >                                                  Look at SQLAlchemy,   
   > for example , which   
   > does a lot of this. Is that a bad example of an ORM?   
      
   I prefer SQLModel on top of SQLAlchemy, but ...   
      
   Even with ORM you need to express the query.   
      
   There are 3 common ways to express a query in   
   an ORM:   
   * an ORM specific query language similar to but not identical   
      to SQL. Examples: JPQL (Java), HQL (Java), DQL (PHP) etc..   
   * plain SQL. Example: MyBatis (Java)   
   * fluent API. Examples: EF (.NET), SQLModel and SQLAlchemy   
      (Python)   
      
   But even though the ORM framework authors undoubtedly   
   have strong opinions about that choice, then in the   
   big picture it does not matter.   
      
   JPQL example (ORM specific query language):   
      
   List res = em.createQuery("SELECT o FROM T1 AS o WHERE o.f > 0",   
   T1.class).getResultList();   
      
   EF example (fluent API):   
      
   List res = db.T1.Where(o => o.F > 0).ToList();   
      
   That will both end up executing the SQL:   
      
   SELECT * FROM t1 WHERE f > 0   
      
   It is fundamentally the same query. Just slightly different   
   syntax.   
      
   SQLAlchemy have chosen the fluent API model.   
      
   The big difference in the above two examples compared   
   to traditional SQL API (JDBC and ADO.NET for Java and .NET)   
   is that it return a List instead of a generic result   
   like List.   
      
   Arne   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca