# Seeking help on SQL query for the group level in SQL Data Source migration to Extension 2.0

**URL:** <https://community.dynatrace.com/t/seeking-help-on-sql-query-for-the-group-level-in-sql-data-source-migration-to-extension-2-0/50646>\
**Category:** Extensions\
**Tags:** databases, sql, mssql, oracle, extensions\
**Created:** [March 10, 2025, 8:19pm UTC](https://community.dynatrace.com/t/seeking-help-on-sql-query-for-the-group-level-in-sql-data-source-migration-to-extension-2-0/50646 "2025-03-10T20:19:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![DarshanDoshi](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/darshandoshi/32/11802_2.png) [@DarshanDoshi](https://community.dynatrace.com/u/DarshanDoshi)\
**Post date:** [March 10, 2025, 8:19pm UTC](https://community.dynatrace.com/t/seeking-help-on-sql-query-for-the-group-level-in-sql-data-source-migration-to-extension-2-0/50646/1 "2025-03-10T20:19:10Z")

</div>

Hi There,  
I am working on migration task on our Custom DB Query written in python on Dynatrace managed using extension 1.0 to Extension 2.0 - SQL Data Source. Though it is successful, I wasn’t able to define it as group and sub-group in our scenario. Seeking for a help in what SQL query should I define in the group level, in case I re-define 2nd, 3rd and 4th group in below example as a sub-group. Such that I can make use of same extension up to 100 metrics. Otherwise, I will be limited to 10 metrics only (assume if only one metric defined against each sql query in a group and no sub-group exist). Note, where possible I tried to merge multiple queries into one single queries. In below example, assume I cannot merge queries into one single sql statement. I do make use of dimension and multiple keys where possible. These queries are specific to application tables and not any generic that can be used across the database or server.

sqlServer:&nbsp; - group: GroupDBOne\_ServerOne&nbsp; &nbsp; featureSet: FeatureSetOne\_TableOne&nbsp; &nbsp; query: SELECT COUNT(\*) AS ColumnO1 FROM TableO (NOLOCK) WHERE condition&nbsp; &nbsp; metrics:&nbsp; &nbsp; &nbsp; - key: key.colO1&nbsp; &nbsp; &nbsp; &nbsp; value: col:ColumnO1&nbsp; &nbsp; &nbsp; &nbsp; type: gauge&nbsp; &nbsp; interval:&nbsp; &nbsp; &nbsp; minutes: 15&nbsp; &nbsp; timeout: “120”&nbsp; - group: GroupDBTwo\_SeverTwo\_1&nbsp; &nbsp; featureSet: FeatureSetTwo\_TableOne\_1&nbsp; &nbsp; query: SELECT COUNT(\*) AS ColumnT1 FROM TableT (NOLOCK) WHERE ColumnT LIKE’TextOne’&nbsp; &nbsp; metrics:&nbsp; &nbsp; &nbsp; - key: key.ColT1&nbsp; &nbsp; &nbsp; &nbsp; value: col:ColumnT1&nbsp; &nbsp; &nbsp; &nbsp; type: gauge&nbsp; &nbsp; interval:&nbsp; &nbsp; &nbsp; minutes: 15&nbsp; &nbsp; timeout: “120”&nbsp; - group: GroupDBTwo\_SeverTwo\_2&nbsp; &nbsp; featureSet: FeatureSetTwo\_TableOne\_2&nbsp; &nbsp; query: SELECT COUNT(\*) AS ColumnT2 FROM TableT (NOLOCK) WHERE ColumnT LIKE’TextTwo’&nbsp; &nbsp; metrics:&nbsp; &nbsp; &nbsp; - key: key.ColT2&nbsp; &nbsp; &nbsp; &nbsp; value: col:ColumnT2&nbsp; &nbsp; &nbsp; &nbsp; type: gauge&nbsp; &nbsp; interval:&nbsp; &nbsp; &nbsp; minutes: 15&nbsp; &nbsp; timeout: “120”  
&nbsp; - group: GroupDBTwo\_SeverTwo\_3&nbsp; &nbsp; featureSet: FeatureSetTwo\_TableOne\_3&nbsp; &nbsp; query: SELECT COUNT(\*) AS ColumnT3 FROM TableT (NOLOCK) WHERE ColumnT LIKE’TextThree’&nbsp; &nbsp; metrics:&nbsp; &nbsp; &nbsp; - key: key.ColT3&nbsp; &nbsp; &nbsp; &nbsp; value: col:ColumnT3&nbsp; &nbsp; &nbsp; &nbsp; type: gauge&nbsp; &nbsp; interval:&nbsp; &nbsp; &nbsp; minutes: 15&nbsp; &nbsp; timeout: “120”

Thanks and Regards,  
Darshan Doshi

---

<div class="post-metadata">

**Author:** ![Tom\_sSeroteRoos](https://avatars.discourse-cdn.com/v4/letter/t/bb73d2/32.png) [@Tom\_sSeroteRoos](https://community.dynatrace.com/u/Tom_sSeroteRoos)\
**Post date:** [December 19, 2025, 11:17am UTC](https://community.dynatrace.com/t/seeking-help-on-sql-query-for-the-group-level-in-sql-data-source-migration-to-extension-2-0/50646/2 "2025-12-19T11:17:29Z")

</div>

Hi Darshan,

If all your queries are completely unrelated, I think you should be able to do something like this:

```markup
- group: my_group
    subgroups:
      - subgroup: test
        ingest: metrics
        query: SELECT value FROM table
        metrics:
        - key: mykey
          value: col:value

```

and have 10 subgroups on each of your 10 groups, so 100 queries in total.

Group level queries can be useful if you want to extract the same dimension for all the queries in the subgroup. For example, on our Oracle DB extension, we use a group level query like this:

```markup
- group: Instance
    query: >
      SELECT DISTINCT DATABASE_TYPE FROM GV$INSTANCE
    dimensions:
      - key: database.type
        value: col:DATABASE_TYPE
    subgroups:
       ...

```

to have the&nbsp;_database.type_ dimension as part of every metric extracted from the subgroup.
