# Record start and finish time of a graph

**URL:** <https://forum.cloverdx.com/t/record-start-and-finish-time-of-a-graph/884>\
**Category:** CloverDX Platform\
**Created:** [July 5, 2011, 12:00am UTC](https://forum.cloverdx.com/t/record-start-and-finish-time-of-a-graph/884 "2011-07-05T00:00:00Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![kasturi](https://avatars.discourse-cdn.com/v4/letter/k/a698b9/32.png) [@kasturi](https://forum.cloverdx.com/u/kasturi)\
**Post date:** [July 5, 2011, 12:00am UTC](https://forum.cloverdx.com/t/record-start-and-finish-time-of-a-graph/884/1 "2011-07-05T00:00:00Z")

</div>

I want to record the date and time of start and finish of a graph in a database table. I can then use that date/time to extract data from source for incremental load. I am not sure how to do that.

---

<div class="post-metadata">

**Author:** ![jurban](https://avatars.discourse-cdn.com/v4/letter/j/cc9497/32.png) [@jurban](https://forum.cloverdx.com/u/jurban)\
**Post date:** [July 7, 2011, 8:48am UTC](https://forum.cloverdx.com/t/record-start-and-finish-time-of-a-graph/884/2 "2011-07-07T08:48:53Z")

</div>

Hi,

you can use phases and DBExecute components for this:

1. first phase - DBExecute with a statement that writes current timestamp (e.g. something like UPDATE GraphTimestamps SET Start=CURRENT\_TIMESTAMP , but the statement is database specific)
2. ordinary phases of your graph - let the graph do its business logic
3. separate final phase - similar DBExecute to write the current timestamp

However, are you sure this is the best way for you of doing incremental load? CloverETL has built-in support for incremental loading, see documentation:  
[http://www.cloveretl.com/documentation/ … ading.html](http://www.cloveretl.com/documentation/UserGuide/index.jsp?topic=/com.cloveretl.gui.docs/docs/incremental-reading.html)  
[http://www.cloveretl.com/documentation/ … table.html](http://www.cloveretl.com/documentation/UserGuide/index.jsp?topic=/com.cloveretl.gui.docs/docs/dbinputtable.html)

Best regards,  
Jaro

---

<div class="post-metadata">

**Author:** ![kasturi](https://avatars.discourse-cdn.com/v4/letter/k/a698b9/32.png) [@kasturi](https://forum.cloverdx.com/u/kasturi)\
**Post date:** [July 7, 2011, 1:47pm UTC](https://forum.cloverdx.com/t/record-start-and-finish-time-of-a-graph/884/3 "2011-07-07T13:47:48Z")

</div>

Jaro,  
Thank you very much for your reply. I read the documentation on the links you have sent me. I will definitely use clover’s built in function.  
I tried to use it. It is giving me an warning on not having incremental file defined. I also am not clear on ‘initial value’. I am loading based on the last updated date of the record. I am defining the key as Max(updated\_date). Can I leave the initial value blank? In the select clause, I am using the ‘where’ clause with #Key.  
Kasturi

---

<div class="post-metadata">

**Author:** ![avackova](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@avackova](https://forum.cloverdx.com/u/avackova)\
**Post date:** [July 12, 2011, 11:14am UTC](https://forum.cloverdx.com/t/record-start-and-finish-time-of-a-graph/884/4 "2011-07-12T11:14:49Z")

</div>

Hello Kasturi,  
current value of the key must be defined. It can be done in two ways:

- current value is read from the incremental file

- if incremental file doesn’t exist or the key value is not defined in it, initial value is used - in your case use any date earlier from the all dates, that can be in _updated\_date_ field

See ExtExamples/graph/graphDBUnload.grf from our [examples](http://www.cloveretl.com/resources/download/examples/latest/examples).

---

<div class="post-metadata">

**Author:** ![kasturi](https://avatars.discourse-cdn.com/v4/letter/k/a698b9/32.png) [@kasturi](https://forum.cloverdx.com/u/kasturi)\
**Post date:** [July 21, 2011, 5:15pm UTC](https://forum.cloverdx.com/t/record-start-and-finish-time-of-a-graph/884/5 "2011-07-21T17:15:25Z")

</div>

Hello Agata ,  
Thank you for your reply. I could use incremental file to run some graphs. However, sometimes I am getting this following error “Node DB\_INPUT\_TABLE0 finished with status: ERROR caused by: “where” clause not found in sql query!!!”.  
I have defined the incremental file, incremental key and also the initial value. In the where clause, I am also using where clause to take the records \> #key01 ( which is what should have the max updated date as defined in the incremental key). I cannot find the cause of this error. What am I missing here?  
Regards,  
Kasturi

---

<div class="post-metadata">

**Author:** ![avackova](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@avackova](https://forum.cloverdx.com/u/avackova)\
**Post date:** [July 22, 2011, 10:08am UTC](https://forum.cloverdx.com/t/record-start-and-finish-time-of-a-graph/884/6 "2011-07-22T10:08:31Z")

</div>

Hello Kasturi,  
can you show your graph?  
The exception should be thrown only if _incrementalKey_ is set but _where_ is missing in _sqlQuery_.

---

<div class="post-metadata">

**Author:** ![kasturi](https://avatars.discourse-cdn.com/v4/letter/k/a698b9/32.png) [@kasturi](https://forum.cloverdx.com/u/kasturi)\
**Post date:** [July 22, 2011, 2:54pm UTC](https://forum.cloverdx.com/t/record-start-and-finish-time-of-a-graph/884/7 "2011-07-22T14:54:53Z")

</div>

Hello Agata,  
Thank you for your quick reply. I am attaching the graph that is giving me this ‘where’ clause not found message.  
We are using mysql 5.0.44 as our source . Our target database id postgres(  
PostgreSQL 9.0.2 on x86\_64-unknown-linux-gnu, compiled by GCC gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-46), 64-bit).  
Regards,  
Kasturi

- [LoadUserTelephoneincr.grf](https://cdn.cloverdx.com/forum/13611%5F0b12ed307a8b82bbde0c92a871e57ac5/LoadUserTelephoneincr.grf)

---

<div class="post-metadata">

**Author:** ![avackova](https://avatars.discourse-cdn.com/v4/letter/a/65b543/32.png) [@avackova](https://forum.cloverdx.com/u/avackova)\
**Post date:** [July 25, 2011, 10:48am UTC](https://forum.cloverdx.com/t/record-start-and-finish-time-of-a-graph/884/8 "2011-07-25T10:48:58Z")

</div>

Hello Kasturi,  
the problem is, that DBInputTable recognizes only lower case “where” clause ([https://bug.javlin.eu/browse/CL-1860](https://bug.javlin.eu/browse/CL-1860)). Please change it to lower case.
