[Erp5-users] ERP5 questions
jp at nexedi.com
jp at nexedi.com
Fri Apr 12 11:13:09 CEST 2013
Hi,
.ome additional comments
> 2.- I found that a zsql method has two functions: its generates sql to send to
> the databse and converts the response of the database in an object, then a ZSQL
> method acts as an Object-Relational Mapping?
zsql method does not convert response of the database into an object and does not act as an ORM.
If you think about the main purpose of an ORM, ie. persistency, ERP5 relies on ZODB mechanism to implement object persistency in a way which does not require an ORM. You could call it ORM-less persistency or native persistency. Unlike ORM based approaches, it does not suffer from impedance adapation problems, data model upgrade problems or poor support for generic types. In short, unlike ORM based system, it works always.
zsql method are used to query the index built by ERP5Catalog (portal_catalog) or any SQL database. The result is provided in a lazy structure. So-called "brains" can be used to adapt this lazy structure and return about anything. The standard brain used in ERP5 takes the "path" property of the lazy structure returned by the brain and finds which object stored in ZODB has the same path, then returns that object. This is how the relation between the index (stored in an SQL database or possibily into any form of index, including graph, semantic, full text, etc.) and persistent objects is automated.
But there are other applications. The inventory mangement API in ERP5 generates SQL queries which return lists of products with current inventory value or history of movements. SQL in this case is used in a way which is closer to what one would do in a datawarehouse or in an OLAP application.
Regards,
JPS.
More information about the Erp5-users
mailing list