diff --git a/.docs/changelog.md b/.docs/changelog.md
index af778b5ec5dcb39408d403e1088e966ca2fe4995..7dbd4f1bb7e4f1b68c50ca4a90d36bfd3ad66219 100644
--- a/.docs/changelog.md
+++ b/.docs/changelog.md
@@ -6,13 +6,16 @@ author: Martin Weise
 
 #### Features
 
-* Fixed a bug where validation of missing `Principal` object in Java services caused a 400 error instead of a 401 error
-  in [#512](https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/-/issues/512).
 * Refactored internal Java-based testing data that improves test consistency
   in [#510](https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/-/issues/510).
 * Added automated dashboard generation for all public databases where each view has an overview of its data and
   schema in [#460](https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/-/issues/460).
 
+#### Fixes
+
+* Fixed a bug where validation of missing `Principal` object in Java services caused a 400 error instead of a 401 error
+  in [#512](https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/-/issues/512).
+
 ## v1.7.3 (2025-03-17)
 
 [:simple-gitlab: GitLab Release](https://gitlab.phaidra.org/fair-data-austria-db-repository/fda-services/-/tags/v1.7.3)
diff --git a/dbrepo-auth-service/listeners/target/create-event-listener.jar b/dbrepo-auth-service/listeners/target/create-event-listener.jar
index b06b36948412531f7600be5319d91696faf23810..c45fcf9fa8e58ddb816cd6f9afb13cfd470c001b 100644
Binary files a/dbrepo-auth-service/listeners/target/create-event-listener.jar and b/dbrepo-auth-service/listeners/target/create-event-listener.jar differ
diff --git a/dbrepo-data-service/rest-service/src/main/java/at/tuwien/endpoints/SubsetEndpoint.java b/dbrepo-data-service/rest-service/src/main/java/at/tuwien/endpoints/SubsetEndpoint.java
index 2a7add8ff4a69341be4ac33b97df8141c9ff4713..28e7b2ca9c3ca4d59bbff455b5935e1b3da6631c 100644
--- a/dbrepo-data-service/rest-service/src/main/java/at/tuwien/endpoints/SubsetEndpoint.java
+++ b/dbrepo-data-service/rest-service/src/main/java/at/tuwien/endpoints/SubsetEndpoint.java
@@ -254,8 +254,8 @@ public class SubsetEndpoint extends RestEndpoint {
             QueryStoreInsertException, TableMalformedException, PaginationException, QueryNotSupportedException,
             NotAllowedException, UserNotFoundException, MetadataServiceException, TableNotFoundException,
             ViewMalformedException, ViewNotFoundException, ImageNotFoundException, FormatNotAvailableException {
-        log.debug("endpoint create subset in database, databaseId={}, page={}, size={}, timestamp={}", databaseId,
-                page, size, timestamp);
+        log.debug("endpoint create subset in database, databaseId={}, page={}, size={}, timestamp={}, data.datasource_id={}",
+                databaseId, page, size, timestamp, data.getDatasourceId());
         /* check */
         endpointValidator.validateDataParams(page, size);
         endpointValidator.validateSubsetParams(data);
diff --git a/dbrepo-data-service/rest-service/src/main/java/at/tuwien/endpoints/ViewEndpoint.java b/dbrepo-data-service/rest-service/src/main/java/at/tuwien/endpoints/ViewEndpoint.java
index 245ca0ca26e0f835a183fef5d5a5bd16867cbc63..73d88f0bef1eec5db04c941f2be7bd94755b4ea0 100644
--- a/dbrepo-data-service/rest-service/src/main/java/at/tuwien/endpoints/ViewEndpoint.java
+++ b/dbrepo-data-service/rest-service/src/main/java/at/tuwien/endpoints/ViewEndpoint.java
@@ -49,7 +49,6 @@ public class ViewEndpoint extends RestEndpoint {
     private final DSLContext context;
     private final ViewService viewService;
     private final CacheService cacheService;
-    private final TableService tableService;
     private final MariaDbMapper mariaDbMapper;
     private final SubsetService subsetService;
     private final StorageService storageService;
@@ -58,13 +57,11 @@ public class ViewEndpoint extends RestEndpoint {
 
     @Autowired
     public ViewEndpoint(DSLContext context, ViewService viewService, CacheService cacheService,
-                        TableService tableService, MariaDbMapper mariaDbMapper, SubsetService subsetService,
-                        StorageService storageService, DatabaseService databaseService,
-                        EndpointValidator endpointValidator) {
+                        MariaDbMapper mariaDbMapper, SubsetService subsetService, StorageService storageService,
+                        DatabaseService databaseService, EndpointValidator endpointValidator) {
         this.context = context;
         this.viewService = viewService;
         this.cacheService = cacheService;
-        this.tableService = tableService;
         this.mariaDbMapper = mariaDbMapper;
         this.subsetService = subsetService;
         this.storageService = storageService;
@@ -139,7 +136,7 @@ public class ViewEndpoint extends RestEndpoint {
                             mediaType = "application/json",
                             schema = @Schema(implementation = ApiErrorDto.class))}),
             @ApiResponse(responseCode = "404",
-                    description = "Failed to find database in metadata database",
+                    description = "Failed to find database (or table or view) in metadata database",
                     content = {@Content(
                             mediaType = "application/json",
                             schema = @Schema(implementation = ApiErrorDto.class))}),
@@ -157,7 +154,7 @@ public class ViewEndpoint extends RestEndpoint {
     public ResponseEntity<ViewDto> create(@NotNull @PathVariable("databaseId") UUID databaseId,
                                           @Valid @RequestBody CreateViewDto data) throws DatabaseUnavailableException,
             DatabaseNotFoundException, RemoteUnavailableException, ViewMalformedException, MetadataServiceException,
-            TableNotFoundException, ImageNotFoundException, QueryMalformedException {
+            TableNotFoundException, ImageNotFoundException, QueryMalformedException, ViewNotFoundException {
         log.debug("endpoint create view, databaseId={}, data.name={}", databaseId, data.getName());
         /* check */
         endpointValidator.validateSubsetParams(data.getQuery());
diff --git a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/endpoint/ViewEndpointUnitTest.java b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/endpoint/ViewEndpointUnitTest.java
index dfed71fbbb36b62f86d2311fc9555de451ecc77f..b4215747e3f9a02e91ab8fef2e7f2eb7f3750bfd 100644
--- a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/endpoint/ViewEndpointUnitTest.java
+++ b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/endpoint/ViewEndpointUnitTest.java
@@ -63,7 +63,7 @@ public class ViewEndpointUnitTest extends BaseTest {
     @WithMockUser(username = USER_LOCAL_ADMIN_USERNAME, authorities = {"system"})
     public void create_succeeds() throws DatabaseNotFoundException, RemoteUnavailableException, ViewMalformedException,
             SQLException, DatabaseUnavailableException, MetadataServiceException, TableNotFoundException,
-            ImageNotFoundException, QueryMalformedException {
+            ImageNotFoundException, QueryMalformedException, ViewNotFoundException {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_1_ID, true))
diff --git a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/SubsetServiceIntegrationTest.java b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/SubsetServiceIntegrationTest.java
index a3b0561bcc11be8d22eaafa0703baf28c2c7b419..f6bd02059b9769538e939cd6934d0049a55610ad 100644
--- a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/SubsetServiceIntegrationTest.java
+++ b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/SubsetServiceIntegrationTest.java
@@ -241,7 +241,7 @@ public class SubsetServiceIntegrationTest extends BaseTest {
 
     @Test
     public void create_succeeds() throws SQLException, QueryStoreInsertException, ViewMalformedException,
-            TableNotFoundException, QueryMalformedException, ImageNotFoundException {
+            TableNotFoundException, QueryMalformedException, ImageNotFoundException, ViewNotFoundException {
 
         /* test */
         final UUID response = subsetService.create(DATABASE_1_PRIVILEGED_DTO, QUERY_1_SUBSET_DTO, QUERY_1_CREATED, USER_1_ID);
@@ -252,9 +252,10 @@ public class SubsetServiceIntegrationTest extends BaseTest {
     @MethodSource("create_arguments")
     public void create_illegalQuery_succeeds(String name, String injection) throws TableNotFoundException,
             QueryStoreInsertException, ViewMalformedException, SQLException, QueryMalformedException,
-            ImageNotFoundException {
+            ImageNotFoundException, ViewNotFoundException {
         final SubsetDto request = SubsetDto.builder()
-                .tableId(TABLE_1_ID)
+                .datasourceId(TABLE_1_ID)
+                .datasourceType(DatasourceType.TABLE)
                 .columns(new LinkedList<>(List.of(COLUMN_1_1_ID, COLUMN_1_2_ID, COLUMN_1_3_ID, COLUMN_1_4_ID, COLUMN_1_5_ID)))
                 .filter(new LinkedList<>(List.of(FilterDto.builder()
                         .type(FilterTypeDto.WHERE)
diff --git a/dbrepo-data-service/services/src/main/java/at/tuwien/mapper/MariaDbMapper.java b/dbrepo-data-service/services/src/main/java/at/tuwien/mapper/MariaDbMapper.java
index 4861a7a1d7675a2e9b1008700face58c4c688758..7a0a094e16e8f191cbc1b5ece7b1755485cdded0 100644
--- a/dbrepo-data-service/services/src/main/java/at/tuwien/mapper/MariaDbMapper.java
+++ b/dbrepo-data-service/services/src/main/java/at/tuwien/mapper/MariaDbMapper.java
@@ -2,6 +2,7 @@ package at.tuwien.mapper;
 
 import at.ac.tuwien.ifs.dbrepo.core.api.container.image.OperatorDto;
 import at.ac.tuwien.ifs.dbrepo.core.api.database.DatabaseDto;
+import at.ac.tuwien.ifs.dbrepo.core.api.database.ViewDto;
 import at.ac.tuwien.ifs.dbrepo.core.api.database.query.FilterDto;
 import at.ac.tuwien.ifs.dbrepo.core.api.database.query.FilterTypeDto;
 import at.ac.tuwien.ifs.dbrepo.core.api.database.query.OrderDto;
@@ -13,13 +14,10 @@ import at.ac.tuwien.ifs.dbrepo.core.api.database.table.TupleUpdateDto;
 import at.ac.tuwien.ifs.dbrepo.core.api.database.table.columns.ColumnDto;
 import at.ac.tuwien.ifs.dbrepo.core.api.database.table.columns.ColumnTypeDto;
 import at.ac.tuwien.ifs.dbrepo.core.api.database.table.columns.CreateTableColumnDto;
-import at.ac.tuwien.ifs.dbrepo.core.exception.ImageNotFoundException;
-import at.ac.tuwien.ifs.dbrepo.core.exception.QueryMalformedException;
-import at.ac.tuwien.ifs.dbrepo.core.exception.TableMalformedException;
-import at.ac.tuwien.ifs.dbrepo.core.exception.TableNotFoundException;
+import at.ac.tuwien.ifs.dbrepo.core.exception.*;
 import at.tuwien.utils.MariaDbUtil;
-import org.jooq.Record;
 import org.jooq.*;
+import org.jooq.Record;
 import org.jooq.conf.ParamType;
 import org.mapstruct.Mapper;
 import org.mapstruct.Named;
@@ -895,15 +893,30 @@ public interface MariaDbMapper {
     }
 
     default String subsetDtoToRawQuery(DSLContext context, DatabaseDto database, SubsetDto data)
-            throws TableNotFoundException, ImageNotFoundException {
-        final TableDto table = tableIdToTableDto(database, data.getTableId());
-        final List<Field<Object>> columns = table.getColumns()
-                .stream()
-                .filter(c -> data.getColumns().contains(c.getId()))
-                .map(c -> field(name(c.getInternalName())))
-                .toList();
+            throws TableNotFoundException, ImageNotFoundException, ViewNotFoundException {
+        final String datasourceName;
+        final List<Field<Object>> columns = switch (data.getDatasourceType()) {
+            case TABLE -> {
+                final TableDto table = tableIdToTableDto(database, data.getDatasourceId());
+                datasourceName = table.getInternalName();
+                yield table.getColumns()
+                        .stream()
+                        .filter(c -> data.getColumns().contains(c.getId()))
+                        .map(c -> field(name(c.getInternalName())))
+                        .toList();
+            }
+            case VIEW -> {
+                final ViewDto view = viewIdToViewDto(database, data.getDatasourceId());
+                datasourceName = view.getInternalName();
+                yield view.getColumns()
+                        .stream()
+                        .filter(c -> data.getColumns().contains(c.getId()))
+                        .map(c -> field(name(c.getInternalName())))
+                        .toList();
+            }
+        };
         final SelectJoinStep<Record> query = context.select(columns)
-                .from(name(table.getInternalName()));
+                .from(name(datasourceName));
         final SelectConditionStep<Record> where = subsetDtoToSelectConditions(query, database, data);
         final String sql;
         if (data.getOrder() == null) {
@@ -972,4 +985,17 @@ public interface MariaDbMapper {
         return optional.get();
     }
 
+    default ViewDto viewIdToViewDto(DatabaseDto database, UUID viewId) throws ViewNotFoundException {
+        final Optional<ViewDto> optional = database.getViews()
+                .stream()
+                .filter(v -> v.getId().equals(viewId))
+                .findFirst();
+        if (optional.isEmpty()) {
+            log.error("Failed to find view with id: {}", viewId);
+            log.trace("known view ids: {}", database.getViews().stream().map(ViewDto::getId).collect(Collectors.toList()));
+            throw new ViewNotFoundException("Failed to find view id: " + viewId);
+        }
+        return optional.get();
+    }
+
 }
diff --git a/dbrepo-data-service/services/src/main/java/at/tuwien/service/SubsetService.java b/dbrepo-data-service/services/src/main/java/at/tuwien/service/SubsetService.java
index 30f6c2604fbea95af91aa856fa2725477591eec3..b57c2b3f106f544cc0b37bfbd17c78b3a315a5e5 100644
--- a/dbrepo-data-service/services/src/main/java/at/tuwien/service/SubsetService.java
+++ b/dbrepo-data-service/services/src/main/java/at/tuwien/service/SubsetService.java
@@ -26,7 +26,7 @@ public interface SubsetService {
      * @throws SQLException              The connection to the database could not be established.
      */
     UUID create(DatabaseDto database, SubsetDto subset, Instant timestamp, UUID userId)
-            throws QueryStoreInsertException, SQLException, QueryMalformedException, TableNotFoundException, ImageNotFoundException, ViewMalformedException;
+            throws QueryStoreInsertException, SQLException, QueryMalformedException, TableNotFoundException, ImageNotFoundException, ViewMalformedException, ViewNotFoundException;
 
     /**
      * Counts the subset row count of a query of a given subset in the given database.
diff --git a/dbrepo-data-service/services/src/main/java/at/tuwien/service/impl/SubsetServiceMariaDbImpl.java b/dbrepo-data-service/services/src/main/java/at/tuwien/service/impl/SubsetServiceMariaDbImpl.java
index 7ace8e4a0595477f96f01151668ebd0f9ed321dd..1b9757659f1f7fad1824034fcffb5c5f0949cc11 100644
--- a/dbrepo-data-service/services/src/main/java/at/tuwien/service/impl/SubsetServiceMariaDbImpl.java
+++ b/dbrepo-data-service/services/src/main/java/at/tuwien/service/impl/SubsetServiceMariaDbImpl.java
@@ -70,7 +70,7 @@ public class SubsetServiceMariaDbImpl extends DataConnector implements SubsetSer
     @Override
     public UUID create(DatabaseDto database, SubsetDto subset, Instant timestamp, UUID userId)
             throws QueryStoreInsertException, SQLException, QueryMalformedException, TableNotFoundException,
-            ImageNotFoundException, ViewMalformedException {
+            ImageNotFoundException, ViewMalformedException, ViewNotFoundException {
         final String statement = mariaDbMapper.subsetDtoToRawQuery(context, database, subset);
         return storeQuery(database, statement, timestamp, userId);
     }
diff --git a/dbrepo-ui/components/subset/Builder.vue b/dbrepo-ui/components/subset/Builder.vue
index 52fff4c4df37a474b3686c0c6d5cffda85cae7af..4e4fe21eecb64311937e737fd2a0f7aeaf2f56f3 100644
--- a/dbrepo-ui/components/subset/Builder.vue
+++ b/dbrepo-ui/components/subset/Builder.vue
@@ -91,9 +91,9 @@
                 <v-col
                   lg="4">
                   <v-select
-                    v-model="table"
+                    v-model="datasource"
                     :disabled="isExecuted"
-                    :items="tables"
+                    :items="datasources"
                     item-title="name"
                     return-object
                     persistent-hint
@@ -108,7 +108,7 @@
                   <v-select
                     v-model="select"
                     item-title="internal_name"
-                    :disabled="!table || isExecuted"
+                    :disabled="!datasource || isExecuted"
                     :items="columns"
                     :rules="[v => !!v || $t('validation.required')]"
                     required
@@ -375,7 +375,7 @@ export default {
   },
   data () {
     return {
-      table: null,
+      datasource: null,
       views: [],
       columns: [],
       sorts: [],
@@ -393,7 +393,8 @@ export default {
       resultId: null,
       errorKeyword: null,
       query: {
-        table_id: null,
+        datasource_id: null,
+        datasource_type: null,
         columns: [],
         filter: null
       },
@@ -424,11 +425,14 @@ export default {
       }
       return this.database.container.image.operators
     },
-    tables () {
+    datasources () {
       if (!this.database) {
         return []
       }
-      return this.database.tables
+      if (this.isView) {
+        return this.database.tables
+      }
+      return this.database.views
     },
     database () {
       return this.cacheStore.getDatabase
@@ -467,11 +471,12 @@ export default {
       return this.$config.public.database.unsupported.split(',')
     },
     subset () {
-      if (!this.table || !this.select) {
+      if (!this.datasource || !this.select) {
         return null
       }
       return {
-        table_id: this.table.id,
+        datasource_id: this.datasource.id,
+        datasource_type: this.isView ? 'table' : 'view',
         columns: this.select.map(column => column.id),
         filter: this.clauses ? this.clauses.map(clause => {
           if (clause.type === 'or' || clause.type === 'and') {
@@ -479,7 +484,7 @@ export default {
               type: clause.type
             }
           }
-          const filtered_column = this.table.columns.filter(column => column.internal_name === clause.params[0])
+          const filtered_column = this.datasource.columns.filter(column => column.internal_name === clause.params[0])
           const filtered_operator = this.database.container.image.operators.filter(operator => operator.value === clause.params[1])
           if (!filtered_column || filtered_column.length === 0 || !filtered_operator || filtered_operator.length === 0) {
             return null
@@ -514,16 +519,21 @@ export default {
     }
   },
   watch: {
-    table () {
+    datasource () {
       this.select = []
-      if (!this.table) {
+      if (!this.datasource) {
+        return
+      }
+      if (!this.isView) {
+        this.fetchViewColumns(this.datasource?.id)
         return
       }
-      this.fetchTableColumns(this.table?.id)
+      this.fetchTableColumns(this.datasource?.id)
     }
   },
   mounted () {
     this.selectTable()
+    this.selectView()
     this.initViewVisibility()
   },
   methods: {
@@ -544,6 +554,23 @@ export default {
           toast.error(this.$t(code))
         })
     },
+    fetchViewColumns (viewId) {
+      this.loadingColumns = true
+      const viewService = useViewService()
+      viewService.findOne(this.$route.params.database_id, viewId)
+        .then((view) => {
+          this.columns = view.columns
+          this.loadingColumns = false
+        })
+        .catch(({code}) => {
+          this.loadingColumns = false
+          const toast = useToastInstance()
+          if (typeof code !== 'string') {
+            return
+          }
+          toast.error(this.$t(code))
+        })
+    },
     initViewVisibility () {
       if (!this.database) {
         return
@@ -564,13 +591,24 @@ export default {
       }
       const tid = this.$route.query.tid
       const selection = this.tables.filter(t => t.id === tid)
-      if (selection.length > 0) {
-        this.table = selection[0]
-        console.info('Preselect table with id', tid)
-        console.debug('preselected table', this.table)
-      } else {
+      if (selection.length === 0) {
         console.warn('Failed to find table with id', tid)
+        return
+      }
+      this.datasource = selection[0]
+      console.info('Preselect table with id', tid)
+    },
+    selectView () {
+      if (this.$route.query.vid === undefined) {
+        return
+      }
+      const vid = this.$route.query.vid
+      const selection = this.views.filter(v => v.id === vid)
+      if (selection.length === 0) {
+        console.warn('Failed to find view with id', vid)
       }
+      this.datasource = selection[0]
+      console.info('Preselect view with id', vid)
     },
     execute () {
       if (this.isView) {
diff --git a/dbrepo-ui/dto/index.ts b/dbrepo-ui/dto/index.ts
index 3c21ce5abea1e855e3eb84661d0b865b4c7f1fd1..e05e0fc4d48e3b224131dec7d12bf25023c3faf0 100644
--- a/dbrepo-ui/dto/index.ts
+++ b/dbrepo-ui/dto/index.ts
@@ -614,7 +614,8 @@ interface OrderDto {
 }
 
 interface SubsetDto {
-  table_id: string;
+  datasource_id: string;
+  datasource_type: string;
   columns: string[];
   filter: FilterDto[] | null;
   order: OrderDto[] | null;
diff --git a/dbrepo-ui/locales/en-US.json b/dbrepo-ui/locales/en-US.json
index ddbef88b971c19e9c5872cf9f38e2e6a590edce8..242f48a5db0c9062dbc614b972ac96829db41b03 100644
--- a/dbrepo-ui/locales/en-US.json
+++ b/dbrepo-ui/locales/en-US.json
@@ -954,7 +954,7 @@
             "hint": "Required"
           },
           "table": {
-            "label": "Data Table",
+            "label": "Datasource",
             "hint": "Required"
           },
           "columns": {
diff --git a/helm/dbrepo/files/create-event-listener.jar b/helm/dbrepo/files/create-event-listener.jar
index b06b36948412531f7600be5319d91696faf23810..c45fcf9fa8e58ddb816cd6f9afb13cfd470c001b 100644
Binary files a/helm/dbrepo/files/create-event-listener.jar and b/helm/dbrepo/files/create-event-listener.jar differ
diff --git a/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/database/query/DatasourceType.java b/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/database/query/DatasourceType.java
new file mode 100644
index 0000000000000000000000000000000000000000..a4f8a83d8018237808206699231acba791807a2c
--- /dev/null
+++ b/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/database/query/DatasourceType.java
@@ -0,0 +1,25 @@
+package at.ac.tuwien.ifs.dbrepo.core.api.database.query;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
+
+@Schema
+public enum DatasourceType {
+
+    @JsonProperty("table")
+    TABLE("table"),
+
+    @JsonProperty("view")
+    VIEW("view");
+
+    private final String name;
+
+    DatasourceType(String name) {
+        this.name = name;
+    }
+
+    @Override
+    public String toString() {
+        return this.name;
+    }
+}
diff --git a/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/database/query/ExecuteStatementDto.java b/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/database/query/ExecuteStatementDto.java
deleted file mode 100644
index 6973486230a8e0cf3ad77c8bb9fa28b44721223b..0000000000000000000000000000000000000000
--- a/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/database/query/ExecuteStatementDto.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package at.ac.tuwien.ifs.dbrepo.core.api.database.query;
-
-import io.swagger.v3.oas.annotations.media.Schema;
-import lombok.*;
-
-import jakarta.validation.constraints.NotBlank;
-import lombok.extern.jackson.Jacksonized;
-
-@Getter
-@Setter
-@Builder
-@NoArgsConstructor
-@AllArgsConstructor
-@Jacksonized
-@ToString
-public class ExecuteStatementDto {
-
-    @NotBlank
-    @Schema(example = "SELECT `id` FROM `air_quality`")
-    private String statement;
-
-}
diff --git a/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/database/query/ExportDto.java b/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/database/query/ExportDto.java
deleted file mode 100644
index 35f4fff473bc29f68a4055baa872404b3b67f7b6..0000000000000000000000000000000000000000
--- a/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/database/query/ExportDto.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package at.ac.tuwien.ifs.dbrepo.core.api.database.query;
-
-import io.swagger.v3.oas.annotations.media.Schema;
-import jakarta.validation.constraints.NotBlank;
-import lombok.*;
-import lombok.extern.jackson.Jacksonized;
-
-@Getter
-@Setter
-@Builder
-@EqualsAndHashCode
-@NoArgsConstructor
-@AllArgsConstructor
-@Jacksonized
-@ToString
-public class ExportDto {
-
-    @NotBlank
-    @Schema(example = "/tmp/file.csv")
-    private String location;
-}
diff --git a/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/database/query/SubsetDto.java b/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/database/query/SubsetDto.java
index 0b5975e05d06421348bc6733980d0ba1e2be81e0..5fb53d0741ed3740b1d045b2b524d58cb2e7a9e5 100644
--- a/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/database/query/SubsetDto.java
+++ b/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/api/database/query/SubsetDto.java
@@ -20,9 +20,13 @@ import java.util.UUID;
 public class SubsetDto {
 
     @NotNull
-    @JsonProperty("table_id")
+    @JsonProperty("datasource_id")
     @Schema(example = "f7df2a7d-4ade-4c78-97b0-7c744d0893c7")
-    private UUID tableId;
+    private UUID datasourceId;
+
+    @NotNull
+    @JsonProperty("datasource_type")
+    private DatasourceType datasourceType;
 
     @NotNull
     @Schema(example = "[\"e891ba86-0258-41a6-a8d9-ff58bc10b618\"]")
diff --git a/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/test/BaseTest.java b/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/test/BaseTest.java
index d2f622fbd1f295a012f7b8d8218b1db6d533eb29..5209b40ce42e0675cf3c94570444f184f382b3e6 100644
--- a/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/test/BaseTest.java
+++ b/lib/java/dbrepo-core/src/main/java/at/ac/tuwien/ifs/dbrepo/core/test/BaseTest.java
@@ -2587,7 +2587,8 @@ public class BaseTest {
             .build();
 
     public final SubsetDto QUERY_9_SUBSET_DTO = SubsetDto.builder()
-            .tableId(TABLE_9_ID)
+            .datasourceId(TABLE_9_ID)
+            .datasourceType(DatasourceType.TABLE)
             .columns(new LinkedList<>(List.of(COLUMN_9_2_ID, COLUMN_9_3_ID)))
             .filter(new LinkedList<>(List.of(FilterDto.builder()
                     .columnId(COLUMN_9_1_ID)
@@ -2895,7 +2896,8 @@ public class BaseTest {
     public final static Boolean QUERY_1_PERSISTED = true;
 
     public final SubsetDto QUERY_1_SUBSET_DTO = SubsetDto.builder()
-            .tableId(TABLE_1_ID)
+            .datasourceId(TABLE_1_ID)
+            .datasourceType(DatasourceType.TABLE)
             .columns(new LinkedList<UUID>(List.of(COLUMN_1_1_ID, COLUMN_1_2_ID, COLUMN_1_3_ID, COLUMN_1_4_ID, COLUMN_1_5_ID)))
             .order(new LinkedList<OrderDto>(List.of(OrderDto.builder()
                     .columnId(COLUMN_1_1_ID)
@@ -3022,7 +3024,8 @@ public class BaseTest {
             .build();
 
     public final SubsetDto QUERY_5_SUBSET_DTO = SubsetDto.builder()
-            .tableId(TABLE_8_ID)
+            .datasourceId(TABLE_8_ID)
+            .datasourceType(DatasourceType.TABLE)
             .columns(new LinkedList<>(List.of(COLUMN_8_1_ID, COLUMN_8_2_ID)))
             .filter(new LinkedList<>(List.of(FilterDto.builder()
                     .columnId(COLUMN_8_2_ID)
@@ -4598,7 +4601,8 @@ public class BaseTest {
     public final static Boolean QUERY_8_PERSISTED = true;
 
     public final SubsetDto QUERY_8_SUBSET_DTO = SubsetDto.builder()
-            .tableId(TABLE_5_ID)
+            .datasourceId(TABLE_5_ID)
+            .datasourceType(DatasourceType.TABLE)
             .columns(new LinkedList<>(List.of(COLUMN_5_1_ID, COLUMN_5_2_ID)))
             .filter(new LinkedList<>(List.of(FilterDto.builder()
                             .type(FilterTypeDto.WHERE)
@@ -4845,7 +4849,8 @@ public class BaseTest {
     public final static UUID VIEW_COLUMN_1_3_ID = UUID.fromString("4f189a5f-c9ca-4518-9758-1a0730f6276b");
 
     public final SubsetDto VIEW_1_SUBSET_DTO = SubsetDto.builder()
-            .tableId(TABLE_2_ID)
+            .datasourceId(TABLE_2_ID)
+            .datasourceType(DatasourceType.TABLE)
             .columns(new LinkedList<>(List.of(COLUMN_2_1_ID, COLUMN_2_2_ID, COLUMN_2_3_ID)))
             .build();