# Vacuum with variable date

**URL:** <https://community.dremio.com/t/vacuum-with-variable-date/12225>\
**Category:** Apache Iceberg\
**Created:** [August 29, 2024, 8:15am UTC](https://community.dremio.com/t/vacuum-with-variable-date/12225 "2024-08-29T08:15:03Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sebastian](https://avatars.discourse-cdn.com/v4/letter/s/4da419/32.png) [@Sebastian](https://community.dremio.com/u/Sebastian)\
**Post date:** [August 29, 2024, 8:15am UTC](https://community.dremio.com/t/vacuum-with-variable-date/12225/1 "2024-08-29T08:15:03Z")

</div>

Hello,  
I am trying to use the Iceberg vacuum statement with a variable date (e.g. keep all snapshot from last x days). The following code was shown in the Gnarly Data Waves Session on Tuesday, but does not seem to work in my environment (Dremio CE 25.0.0)

VACUUM TABLE tablepath  
EXPIRE SNAPSHOTS older\_than CURRENT\_DATE - INTERVAL ‘30’ DAY retain\_last 20;

Error Message: Encountered “older\_than CURRENT\_DATE” at line 2, column 22.

Is there something I am missing?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![dch](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/dch/32/4140_2.png) [@dch](https://community.dremio.com/u/dch)\
**Post date:** [August 29, 2024, 2:46pm UTC](https://community.dremio.com/t/vacuum-with-variable-date/12225/2 "2024-08-29T14:46:08Z")

</div>

You need to make CURRENT\_DATE a function call by putting parentheses after it - CURRENT\_DATE()

---

<div class="post-metadata">

**Author:** ![Sebastian](https://avatars.discourse-cdn.com/v4/letter/s/4da419/32.png) [@Sebastian](https://community.dremio.com/u/Sebastian)\
**Post date:** [August 30, 2024, 5:56am UTC](https://community.dremio.com/t/vacuum-with-variable-date/12225/3 "2024-08-30T05:56:36Z")

</div>

Unfortunately I still get the same error (although I believe you are right, if the SQL interpreter would get that far). My guess is that Dremio is expecting an actual date after “older\_than” and not other functions to execute.

---

<div class="post-metadata">

**Author:** ![dch](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/dch/32/4140_2.png) [@dch](https://community.dremio.com/u/dch)\
**Post date:** [September 1, 2024, 3:09pm UTC](https://community.dremio.com/t/vacuum-with-variable-date/12225/4 "2024-09-01T15:09:48Z")

</div>

Oh yes, my bad.  
Double-checked that we do not support expressions there.

---

<div class="post-metadata">

**Author:** ![quangbilly79](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/quangbilly79/32/6549_2.png) [@quangbilly79](https://community.dremio.com/u/quangbilly79)\
**Post date:** [December 16, 2024, 3:12am UTC](https://community.dremio.com/t/vacuum-with-variable-date/12225/5 "2024-12-16T03:12:35Z")

</div>

Then do something about it? Add this new feature “support expressions” to dremio?
