# Historian data partitioning table name format

**URL:** <https://forum.inductiveautomation.com/t/historian-data-partitioning-table-name-format/64764>\
**Category:** Ignition\
**Created:** [October 3, 2022, 5:42pm UTC](https://forum.inductiveautomation.com/t/historian-data-partitioning-table-name-format/64764 "2022-10-03T17:42:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bogdan\_Persa](https://avatars.discourse-cdn.com/v4/letter/b/ba8739/32.png) [@Bogdan\_Persa](https://forum.inductiveautomation.com/u/Bogdan_Persa)\
**Post date:** [October 3, 2022, 5:42pm UTC](https://forum.inductiveautomation.com/t/historian-data-partitioning-table-name-format/64764/1 "2022-10-03T17:42:40Z")

</div>

Hey all,

For our historian database, we have data partitioning configured to create a new table every month. We are querying this externally (PowerBI), and need to dynamically select the appropriate table based on month/year the user is trying to see the report for.

I can see this format for the table names: sqlt\_data\_1\_2022\_09 and sqlt\_data\_1\_2022\_10

The year and month portions of the table name are straight forward, however I am not convinced the "1" preceding the year and month is a static value. The data partitioning video on Inductive university shows this as a "7" in that particular instance. Should I expect this "1" to change on me, and if so, under what conditions?

Thanks in advance,

Bogdan

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [October 3, 2022, 5:48pm UTC](https://forum.inductiveautomation.com/t/historian-data-partitioning-table-name-format/64764/2 "2022-10-03T17:48:23Z")

</div>

The 1 corresponds to the 'driver ID'. See the `sqlth_drv` table. A given gateway will have at least two records in `sqlth_drv` - one with a null provider (the ID for that row will be used for the partition table), and one for each realtime tag provider storing history from that gateway.

An option to consider: if you use the WebDev module, you can create a REST API. You would then be able to use `system.tag.queryTagHistory` to abstract over the database implementation details.
