我有以下数据配置:
<document name="locations">
<entity pk="id" name="location" query="select * from locations WHERE isapproved='true'"
deltaImportQuery="select * from locations WHERE updatedate < getdate() AND isapproved='true' AND id='${dataimporter.delta.id}'"
deltaQuery="select id from locations where isapproved='true' AND updatedate > '${dataimporter.last_index_time}'">
<!-- more document fields -->
</entity>
<entity pk="id" name="offerdetails" query="SELECT title AS offer_title,ISNULL(img,'') AS offer_thumb,id AS offer_id
,startdate AS offer_startdate
,enddate AS offer_enddate
,description AS offer_description
FROM offers WHERE objectid=${location.id} AND objecttype=${location.objecttype} AND approved='true' AND startdate < getdate() AND enddate > getdate()"
deltaImportQuery="SELECT title AS offer_title,ISNULL(img,'') AS offer_thumb,id AS offer_id
,startdate AS offer_startdate
,enddate AS offer_enddate
,description AS offer_description FROM offers WHERE updatedate < getdate() AND approved='true' AND id='${dataimporter.delta.id}'"
deltaQuery="SELECT id FROM offers where approved='true' AND updatedate > '${dataimporter.last_index_time}'">
<field name="id" column="offer_id" />
<field name="offer_title" column="offer_title" />
<field name="offer_thumb" column="offer_thumb" />
<field name="offer_startdate" column="offer_startdate" />
<field name="offer_enddate" column="offer_enddate" />
<field name="offer_description" column="offer_description" />
</entity>
</document>
现在,当[locations]
表中的对象更新时,我的delta导入查询/dataimport?command=delta-import
完美无缺。
但是当在[offers]
表中更新商品时,deltaimport命令不会看到这一点
如果要约更新,是否可以通过delta导入相应位置的更新优惠?
然后没有:
一个。必须完全导入所有位置
或
湾必须更新这个单一位置,然后进行常规deltaimport?
答案 0 :(得分:0)
您尝试使用嵌套实体,因此仅适用于位置表,因为增量查询更新仅基于位置日期更新。 现在,您必须为商品编写增量查询,并将其视为单独的实体。
示例:
<entity pk="id" name="location" ....
deltaImportQuery="select * ..
deltaQuery="select ....
</entity>
<entity pk="id" name="offers" ....
deltaImportQuery="select * ..
deltaQuery="select ....
</entity>