# Granularity when creating reflections via SQL

**URL:** <https://community.dremio.com/t/granularity-when-creating-reflections-via-sql/12549>\
**Category:** Dremio Cloud\
**Created:** [November 25, 2024, 10:09pm UTC](https://community.dremio.com/t/granularity-when-creating-reflections-via-sql/12549 "2024-11-25T22:09:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![wabu](https://avatars.discourse-cdn.com/v4/letter/w/c37758/32.png) [@wabu](https://community.dremio.com/u/wabu)\
**Post date:** [November 25, 2024, 10:09pm UTC](https://community.dremio.com/t/granularity-when-creating-reflections-via-sql/12549/1 "2024-11-25T22:09:20Z")

</div>

Hey, I want to create aggregated reflections via dbt / sql with a datetime dimensions. However in the [ALTER TABLE documentation](https://docs.dremio.com/cloud/reference/sql/commands/alter-table/), I don’t find anything about setting the granularity of the dimension via SQL. The granularity of datetime dimensions can however be set via UI as [described in the guild](https://docs.dremio.com/current/sonar/reflections/best-practices).

Did anyone find a way how to set it or do you know if this is a planed feature?

---

<div class="post-metadata">

**Author:** ![Benny\_Chow](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/benny_chow/32/5527_2.png) [@Benny\_Chow](https://community.dremio.com/u/Benny_Chow)\
**Post date:** [December 6, 2024, 8:38pm UTC](https://community.dremio.com/t/granularity-when-creating-reflections-via-sql/12549/2 "2024-12-06T20:38:55Z")

</div>

Looks like this got missed in the documentation. The SQL grammar looks like:

```auto
alter table Samples."samples.dremio.com"."NYC-taxi-trips-iceberg" create aggregate reflection r1 using dimensions ("pickup_datetime" BY DAY)

```

BTW, you could achieve the same outcome by creating a view that groups by the dataset at the day level and then creating a raw reflection on this view. From the planner point of view, these two reflections are identical.
