# CcdbApi.retrieveFromTFileAny: timestamp -1

**URL:** <https://alice-talk.web.cern.ch/t/ccdbapi-retrievefromtfileany-timestamp-1/1228>\
**Category:** O²\
**Created:** [May 30, 2022, 7:40am UTC](https://alice-talk.web.cern.ch/t/ccdbapi-retrievefromtfileany-timestamp-1/1228 "2022-05-30T07:40:55Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tklemenz](https://alice-talk.web.cern.ch/user_avatar/alice-talk.web.cern.ch/tklemenz/32/115_2.png) [@tklemenz](https://alice-talk.web.cern.ch/u/tklemenz)\
**Post date:** [May 30, 2022, 7:40am UTC](https://alice-talk.web.cern.ch/t/ccdbapi-retrievefromtfileany-timestamp-1/1228/1 "2022-05-30T07:40:55Z")

</div>

Hi experts,

can anyone clarify what exactly I get when calling `CcdbApi.retriveFromTFileAny` with the default `timestamp = -1` or rather what conditions concerning the validity of the ccdb objects are applied?

For quite a while my assumption was that it simply returns the file that was most recently uploaded to the ccdb/qcdb but apparently the validity of the object also plays a role. When there is no object that is valid at the moment then I don’t get anything but an error stating that the file does not exist.

```auto
[ERROR] Requested resource does not exist: ccdb-test.cern.ch:8080/TPC/Calib/IDC/IDC0/1653896104764/

```

Does this mean that I get the most recent file where “current timestamp is within the validity range” is true? Or do I get the object that is valid and at the same time the end of validity is the furthest in the future among all objects that are valid at the moment? Or something else?

I am looking forward to any insight that can be provided.

Cheers,  
Thomas

---

<div class="post-metadata">

**Author:** ![swenzel](https://alice-talk.web.cern.ch/letter_avatar_proxy/v4/letter/s/839c29/32.png) [@swenzel](https://alice-talk.web.cern.ch/u/swenzel)\
**Post date:** [May 30, 2022, 7:55am UTC](https://alice-talk.web.cern.ch/t/ccdbapi-retrievefromtfileany-timestamp-1/1228/2 "2022-05-30T07:55:14Z")

</div>

I think `-1` is simply translated to the timestamp at the moment of the query. As far as I know we currently don’t have an API to simply get the last object that was valid some time ago.

---

<div class="post-metadata">

**Author:** ![tklemenz](https://alice-talk.web.cern.ch/user_avatar/alice-talk.web.cern.ch/tklemenz/32/115_2.png) [@tklemenz](https://alice-talk.web.cern.ch/u/tklemenz)\
**Post date:** [May 30, 2022, 8:25am UTC](https://alice-talk.web.cern.ch/t/ccdbapi-retrievefromtfileany-timestamp-1/1228/3 "2022-05-30T08:25:03Z")

</div>

Yes, it looks like it does but can you explain what role the validity of the objects in the ccdb plays when querying?

Apparently, I can only get objects that are valid at the given timestamp. But what happens if there are multiple valid objects?

---

<div class="post-metadata">

**Author:** ![swenzel](https://alice-talk.web.cern.ch/letter_avatar_proxy/v4/letter/s/839c29/32.png) [@swenzel](https://alice-talk.web.cern.ch/u/swenzel)\
**Post date:** [May 30, 2022, 8:28am UTC](https://alice-talk.web.cern.ch/t/ccdbapi-retrievefromtfileany-timestamp-1/1228/4 "2022-05-30T08:28:27Z")

</div>

Then you always get the one that was put/uploaded last. (also pinging @grigoras)

---

<div class="post-metadata">

**Author:** ![tklemenz](https://alice-talk.web.cern.ch/user_avatar/alice-talk.web.cern.ch/tklemenz/32/115_2.png) [@tklemenz](https://alice-talk.web.cern.ch/u/tklemenz)\
**Post date:** [May 30, 2022, 9:05am UTC](https://alice-talk.web.cern.ch/t/ccdbapi-retrievefromtfileany-timestamp-1/1228/5 "2022-05-30T09:05:21Z")

</div>

Ok, thanks for the info!
