diff --git a/.docs/.openapi/api-data.yaml b/.docs/.openapi/api-data.yaml
index fad4c0fd74a39b914dcf0a526b2795e6eb6c923b..bd14ba55057657c5a38d47cc29875d41e5cc1e71 100644
--- a/.docs/.openapi/api-data.yaml
+++ b/.docs/.openapi/api-data.yaml
@@ -59,35 +59,26 @@ paths:
           type: string
           format: date-time
       responses:
-        "200":
-          description: Retrieved view data
-          headers:
-            Access-Control-Expose-Headers:
-              description: Expose `X-Count` custom header
-              required: true
-              style: simple
-            X-Count:
-              description: Number of rows
-              required: true
-              style: simple
+        "503":
+          description: Failed to establish connection with the metadata service
           content:
             application/json:
               schema:
-                type: string
-        "400":
-          description: Request pagination is malformed
+                $ref: "#/components/schemas/ApiErrorDto"
+        "404":
+          description: Failed to find view in metadata database
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "503":
-          description: Failed to establish connection with the metadata service
+        "409":
+          description: View schema could not be mapped
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "404":
-          description: Failed to find view in metadata database
+        "400":
+          description: Request pagination is malformed
           content:
             application/json:
               schema:
@@ -98,12 +89,21 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "409":
-          description: View schema could not be mapped
+        "200":
+          description: Retrieved view data
+          headers:
+            Access-Control-Expose-Headers:
+              description: Expose `X-Count` custom header
+              required: true
+              style: simple
+            X-Count:
+              description: Number of rows
+              required: true
+              style: simple
           content:
             application/json:
               schema:
-                $ref: "#/components/schemas/ApiErrorDto"
+                type: string
       security:
       - basicAuth: []
       - bearerAuth: []
@@ -147,35 +147,26 @@ paths:
           type: string
           format: date-time
       responses:
-        "200":
-          description: Retrieved view data
-          headers:
-            Access-Control-Expose-Headers:
-              description: Expose `X-Count` custom header
-              required: true
-              style: simple
-            X-Count:
-              description: Number of rows
-              required: true
-              style: simple
+        "503":
+          description: Failed to establish connection with the metadata service
           content:
             application/json:
               schema:
-                type: string
-        "400":
-          description: Request pagination is malformed
+                $ref: "#/components/schemas/ApiErrorDto"
+        "404":
+          description: Failed to find view in metadata database
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "503":
-          description: Failed to establish connection with the metadata service
+        "409":
+          description: View schema could not be mapped
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "404":
-          description: Failed to find view in metadata database
+        "400":
+          description: Request pagination is malformed
           content:
             application/json:
               schema:
@@ -186,12 +177,21 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "409":
-          description: View schema could not be mapped
+        "200":
+          description: Retrieved view data
+          headers:
+            Access-Control-Expose-Headers:
+              description: Expose `X-Count` custom header
+              required: true
+              style: simple
+            X-Count:
+              description: Number of rows
+              required: true
+              style: simple
           content:
             application/json:
               schema:
-                $ref: "#/components/schemas/ApiErrorDto"
+                type: string
       security:
       - basicAuth: []
       - bearerAuth: []
@@ -237,8 +237,8 @@ paths:
           type: integer
           format: int64
       responses:
-        "403":
-          description: Not allowed to get table data
+        "400":
+          description: Request pagination or table data select query is malformed
           content:
             application/json:
               schema:
@@ -270,8 +270,8 @@ paths:
             application/json:
               schema:
                 type: string
-        "400":
-          description: Request pagination or table data select query is malformed
+        "403":
+          description: Not allowed to get table data
           content:
             application/json:
               schema:
@@ -312,8 +312,8 @@ paths:
               $ref: "#/components/schemas/TupleUpdateDto"
         required: true
       responses:
-        "403":
-          description: Update table data not allowed
+        "400":
+          description: Request pagination or table data select query is malformed
           content:
             application/json:
               schema:
@@ -324,16 +324,16 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "202":
-          description: Updated table data
         "404":
           description: Failed to find table in metadata database
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "400":
-          description: Request pagination or table data select query is malformed
+        "202":
+          description: Updated table data
+        "403":
+          description: Update table data not allowed
           content:
             application/json:
               schema:
@@ -374,30 +374,30 @@ paths:
               $ref: "#/components/schemas/TupleDto"
         required: true
       responses:
-        "503":
-          description: Failed to establish connection with the metadata service or
-            storage service
+        "404":
+          description: Failed to find table in metadata database or blob in storage
+            service
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "403":
-          description: Create table data not allowed
+        "400":
+          description: Request pagination or table data select query is malformed
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "404":
-          description: Failed to find table in metadata database or blob in storage
-            service
+        "201":
+          description: Created table data
+        "503":
+          description: Failed to establish connection with the metadata service or
+            storage service
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "201":
-          description: Created table data
-        "400":
-          description: Request pagination or table data select query is malformed
+        "403":
+          description: Create table data not allowed
           content:
             application/json:
               schema:
@@ -438,8 +438,8 @@ paths:
               $ref: "#/components/schemas/TupleDeleteDto"
         required: true
       responses:
-        "403":
-          description: Delete table data not allowed
+        "400":
+          description: Request pagination or table data select query is malformed
           content:
             application/json:
               schema:
@@ -450,16 +450,16 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "202":
-          description: Deleted table data
         "404":
           description: Failed to find table in metadata database
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "400":
-          description: Request pagination or table data select query is malformed
+        "202":
+          description: Deleted table data
+        "403":
+          description: Delete table data not allowed
           content:
             application/json:
               schema:
@@ -508,8 +508,8 @@ paths:
           type: integer
           format: int64
       responses:
-        "403":
-          description: Not allowed to get table data
+        "400":
+          description: Request pagination or table data select query is malformed
           content:
             application/json:
               schema:
@@ -541,8 +541,8 @@ paths:
             application/json:
               schema:
                 type: string
-        "400":
-          description: Request pagination or table data select query is malformed
+        "403":
+          description: Not allowed to get table data
           content:
             application/json:
               schema:
@@ -573,6 +573,12 @@ paths:
         schema:
           type: integer
           format: int64
+      - name: timestamp
+        in: query
+        required: false
+        schema:
+          type: string
+          format: date-time
       - name: page
         in: query
         required: false
@@ -586,31 +592,12 @@ paths:
           type: integer
           format: int64
       responses:
-        "403":
-          description: Not allowed to retrieve subset data
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
-        "404":
-          description: Failed to find database in metadata database or query in query
-            store of the data database
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
         "503":
           description: Failed to communicate with database
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "400":
-          description: Invalid pagination
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
         "200":
           description: Retrieved subset data
           headers:
@@ -632,6 +619,25 @@ paths:
             application/json:
               schema:
                 type: string
+        "400":
+          description: Invalid pagination
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
+        "404":
+          description: Failed to find database in metadata database or query in query
+            store of the data database
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
+        "403":
+          description: Not allowed to retrieve subset data
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
       security:
       - bearerAuth: []
       - basicAuth: []
@@ -657,6 +663,12 @@ paths:
         schema:
           type: integer
           format: int64
+      - name: timestamp
+        in: query
+        required: false
+        schema:
+          type: string
+          format: date-time
       - name: page
         in: query
         required: false
@@ -670,31 +682,12 @@ paths:
           type: integer
           format: int64
       responses:
-        "403":
-          description: Not allowed to retrieve subset data
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
-        "404":
-          description: Failed to find database in metadata database or query in query
-            store of the data database
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
         "503":
           description: Failed to communicate with database
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "400":
-          description: Invalid pagination
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
         "200":
           description: Retrieved subset data
           headers:
@@ -716,6 +709,25 @@ paths:
             application/json:
               schema:
                 type: string
+        "400":
+          description: Invalid pagination
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
+        "404":
+          description: Failed to find database in metadata database or query in query
+            store of the data database
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
+        "403":
+          description: Not allowed to retrieve subset data
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
       security:
       - bearerAuth: []
       - basicAuth: []
@@ -746,21 +758,20 @@ paths:
               $ref: "#/components/schemas/QueryPersistDto"
         required: true
       responses:
-        "202":
-          description: Persisted subset
+        "503":
+          description: Failed to communicate with database
           content:
             application/json:
               schema:
-                $ref: "#/components/schemas/QueryDto"
-        "404":
-          description: Failed to find database in metadata database or query in query
-            store of the data database
+                $ref: "#/components/schemas/ApiErrorDto"
+        "202":
+          description: Persisted subset
           content:
             application/json:
               schema:
-                $ref: "#/components/schemas/ApiErrorDto"
-        "503":
-          description: Failed to communicate with database
+                $ref: "#/components/schemas/QueryDto"
+        "403":
+          description: Not allowed to persist subset
           content:
             application/json:
               schema:
@@ -771,8 +782,9 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "403":
-          description: Not allowed to persist subset
+        "404":
+          description: Failed to find database in metadata database or query in query
+            store of the data database
           content:
             application/json:
               schema:
@@ -823,26 +835,26 @@ paths:
       responses:
         "202":
           description: Imported dataset successfully
-        "403":
-          description: Import table dataset not allowed
+        "503":
+          description: Failed to establish connection with the metadata service
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "400":
-          description: Dataset and/or query are malformed
+        "404":
+          description: Failed to find table in metadata database
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "503":
-          description: Failed to establish connection with the metadata service
+        "403":
+          description: Import table dataset not allowed
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "404":
-          description: Failed to find table in metadata database
+        "400":
+          description: Dataset and/or query are malformed
           content:
             application/json:
               schema:
@@ -874,15 +886,15 @@ paths:
         schema:
           type: boolean
       responses:
-        "404":
-          description: Failed to find database in metadata database or query in query
-            store of the data database
+        "503":
+          description: Failed to communicate with database
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "403":
-          description: Not allowed to find subsets
+        "404":
+          description: Failed to find database in metadata database or query in query
+            store of the data database
           content:
             application/json:
               schema:
@@ -895,8 +907,8 @@ paths:
                 type: array
                 items:
                   $ref: "#/components/schemas/QueryDto"
-        "503":
-          description: Failed to communicate with database
+        "403":
+          description: Not allowed to find subsets
           content:
             application/json:
               schema:
@@ -945,15 +957,14 @@ paths:
               $ref: "#/components/schemas/ExecuteStatementDto"
         required: true
       responses:
-        "417":
-          description: Failed to insert query into query store of data database
+        "201":
+          description: Created subset
           content:
             application/json:
               schema:
-                $ref: "#/components/schemas/ApiErrorDto"
-        "404":
-          description: Failed to find database in metadata database or query in query
-            store of the data database
+                type: string
+        "503":
+          description: Failed to communicate with database
           content:
             application/json:
               schema:
@@ -970,20 +981,21 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "201":
-          description: Created subset
+        "404":
+          description: Failed to find database in metadata database or query in query
+            store of the data database
           content:
             application/json:
               schema:
-                type: string
-        "503":
-          description: Failed to communicate with database
+                $ref: "#/components/schemas/ApiErrorDto"
+        "400":
+          description: Malformed select query
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "400":
-          description: Malformed select query
+        "417":
+          description: Failed to insert query into query store of data database
           content:
             application/json:
               schema:
@@ -1020,12 +1032,6 @@ paths:
           type: string
           format: date-time
       responses:
-        "404":
-          description: Failed to find view in metadata database or export dataset
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
         "503":
           description: Failed to establish connection with the metadata service
           content:
@@ -1038,6 +1044,12 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
+        "404":
+          description: Failed to find view in metadata database or export dataset
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
         "200":
           description: Exported view data
           content:
@@ -1083,8 +1095,8 @@ paths:
           type: integer
           format: int64
       responses:
-        "404":
-          description: Failed to find table history in data database
+        "403":
+          description: Find table history not allowed
           content:
             application/json:
               schema:
@@ -1095,8 +1107,8 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "403":
-          description: Find table history not allowed
+        "404":
+          description: Failed to find table history in data database
           content:
             application/json:
               schema:
@@ -1147,8 +1159,8 @@ paths:
           type: string
           format: date-time
       responses:
-        "403":
-          description: Export table data not allowed
+        "400":
+          description: Request pagination or table data select query is malformed
           content:
             application/json:
               schema:
@@ -1159,12 +1171,6 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "404":
-          description: Failed to find table in metadata database
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
         "200":
           description: Exported table data
           content:
@@ -1172,8 +1178,14 @@ paths:
               schema:
                 type: string
                 format: binary
-        "400":
-          description: Request pagination or table data select query is malformed
+        "404":
+          description: Failed to find table in metadata database
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
+        "403":
+          description: Export table data not allowed
           content:
             application/json:
               schema:
@@ -1217,9 +1229,8 @@ paths:
           type: string
           format: date-time
       responses:
-        "404":
-          description: Failed to find database in metadata database or query in query
-            store of the data database
+        "503":
+          description: Failed to communicate with database
           content:
             application/json:
               schema:
@@ -1236,12 +1247,6 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "503":
-          description: Failed to communicate with database
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
         "200":
           description: Found subset
           content:
@@ -1249,6 +1254,13 @@ paths:
               schema:
                 $ref: "#/components/schemas/QueryDto"
             text/csv: {}
+        "404":
+          description: Failed to find database in metadata database or query in query
+            store of the data database
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
         "400":
           description: Malformed select query
           content:
diff --git a/.docs/.openapi/api-metadata.yaml b/.docs/.openapi/api-metadata.yaml
index 6792f0f0e9382fcdeca5fbd6f9a85c9162e7bce6..18fb71db29de89369c93de29296e1d85abc58b37 100644
--- a/.docs/.openapi/api-metadata.yaml
+++ b/.docs/.openapi/api-metadata.yaml
@@ -64,18 +64,25 @@ paths:
               $ref: "#/components/schemas/CreateDatabaseDto"
         required: true
       responses:
-        "409":
-          description: Query store could not be created
+        "403":
+          description: Database create permission is missing or grant permissions
+            at broker service failed
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "201":
-          description: Created a new database
+        "423":
+          description: Database quota exceeded
           content:
             application/json:
               schema:
-                $ref: "#/components/schemas/DatabaseBriefDto"
+                $ref: "#/components/schemas/ApiErrorDto"
+        "400":
+          description: Database create query is malformed or image is not supported
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
         "503":
           description: Failed to save in search service
           content:
@@ -94,21 +101,14 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "403":
-          description: Database create permission is missing or grant permissions
-            at broker service failed
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
-        "423":
-          description: Database quota exceeded
+        "201":
+          description: Created a new database
           content:
             application/json:
               schema:
-                $ref: "#/components/schemas/ApiErrorDto"
-        "400":
-          description: Database create query is malformed or image is not supported
+                $ref: "#/components/schemas/DatabaseBriefDto"
+        "409":
+          description: Query store could not be created
           content:
             application/json:
               schema:
@@ -173,6 +173,12 @@ paths:
           type: string
           format: uuid
       responses:
+        "200":
+          description: Found database access
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/DatabaseAccessDto"
         "403":
           description: No access to this database
           content:
@@ -185,12 +191,6 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "200":
-          description: Found database access
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/DatabaseAccessDto"
       security:
       - bearerAuth: []
       - basicAuth: []
@@ -228,29 +228,29 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "404":
-          description: Database or user not found
+        "502":
+          description: Access could not be updated due to connection error in the
+            data service
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "400":
-          description: Modify access query or database connection is malformed
+        "503":
+          description: Access could not be updated in the data service
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
         "202":
           description: Modified access
-        "502":
-          description: Access could not be updated due to connection error in the
-            data service
+        "404":
+          description: Database or user not found
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "503":
-          description: Access could not be updated in the data service
+        "400":
+          description: Modify access query or database connection is malformed
           content:
             application/json:
               schema:
@@ -291,8 +291,8 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "404":
-          description: Database or user not found
+        "503":
+          description: Access could not be created in the data service
           content:
             application/json:
               schema:
@@ -309,8 +309,8 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "503":
-          description: Access could not be created in the data service
+        "404":
+          description: Database or user not found
           content:
             application/json:
               schema:
@@ -351,6 +351,14 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
+        "403":
+          description: Revoke of access not permitted as no access was found
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
+        "202":
+          description: Deleted access
         "400":
           description: Modify access query or database connection is malformed
           content:
@@ -363,20 +371,12 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "202":
-          description: Deleted access
         "503":
           description: Access could not be revoked in the data service
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "403":
-          description: Revoke of access not permitted as no access was found
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
       security:
       - bearerAuth: []
       - basicAuth: []
@@ -404,6 +404,12 @@ paths:
           type: string
           format: uuid
       responses:
+        "200":
+          description: Found database access
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/DatabaseAccessDto"
         "403":
           description: No access to this database
           content:
@@ -416,12 +422,6 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "200":
-          description: Found database access
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/DatabaseAccessDto"
       security:
       - bearerAuth: []
       - basicAuth: []
@@ -443,8 +443,8 @@ paths:
           type: string
           format: uuid
       responses:
-        "403":
-          description: Find user is not permitted
+        "404":
+          description: User was not found
           content:
             application/json:
               schema:
@@ -455,8 +455,8 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/UserDto"
-        "404":
-          description: User was not found
+        "403":
+          description: Find user is not permitted
           content:
             application/json:
               schema:
@@ -484,26 +484,26 @@ paths:
               $ref: "#/components/schemas/UserUpdateDto"
         required: true
       responses:
-        "400":
-          description: Modify user query is malformed
+        "202":
+          description: Modified user information
           content:
             application/json:
               schema:
-                $ref: "#/components/schemas/ApiErrorDto"
-        "404":
-          description: Failed to find database/user in metadata database
+                $ref: "#/components/schemas/UserDto"
+        "403":
+          description: Not allowed to modify user metadata
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "202":
-          description: Modified user information
+        "400":
+          description: Modify user query is malformed
           content:
             application/json:
               schema:
-                $ref: "#/components/schemas/UserDto"
-        "403":
-          description: Not allowed to modify user metadata
+                $ref: "#/components/schemas/ApiErrorDto"
+        "404":
+          description: Failed to find database/user in metadata database
           content:
             application/json:
               schema:
@@ -532,14 +532,20 @@ paths:
               $ref: "#/components/schemas/UserPasswordDto"
         required: true
       responses:
-        "403":
-          description: Not allowed to change foreign user password
+        "400":
+          description: Invalid password payload
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
         "202":
           description: Modified user password
+        "403":
+          description: Not allowed to change foreign user password
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
         "404":
           description: Failed to find database/user in metadata database
           content:
@@ -558,12 +564,6 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "400":
-          description: Invalid password payload
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
       security:
       - bearerAuth: []
       - basicAuth: []
@@ -581,8 +581,8 @@ paths:
               $ref: "#/components/schemas/RefreshTokenRequestDto"
         required: true
       responses:
-        "502":
-          description: Connection to auth service failed
+        "403":
+          description: Not allowed
           content:
             application/json:
               schema:
@@ -599,8 +599,8 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/TokenDto"
-        "403":
-          description: Not allowed
+        "502":
+          description: Connection to auth service failed
           content:
             application/json:
               schema:
@@ -618,18 +618,31 @@ paths:
               $ref: "#/components/schemas/LoginRequestDto"
         required: true
       responses:
-        "202":
-          description: Obtained user token
+        "404":
+          description: Failed to find user in auth database
           content:
             application/json:
               schema:
-                $ref: "#/components/schemas/TokenDto"
+                $ref: "#/components/schemas/ApiErrorDto"
+        "428":
+          description: Account is not fully setup in auth service (requires password
+            change?)
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
         "400":
           description: Invalid login request
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
+        "202":
+          description: Obtained user token
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/TokenDto"
         "403":
           description: Not allowed to get token
           content:
@@ -648,19 +661,6 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "404":
-          description: Failed to find user in auth database
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
-        "428":
-          description: Account is not fully setup in auth service (requires password
-            change?)
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
   /api/ontology/{ontologyId}:
     get:
       tags:
@@ -737,16 +737,16 @@ paths:
           type: integer
           format: int64
       responses:
-        "202":
-          description: Deleted ontology successfully
-          content:
-            application/json: {}
         "404":
           description: Could not find ontology
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
+        "202":
+          description: Deleted ontology successfully
+          content:
+            application/json: {}
       security:
       - bearerAuth: []
       - basicAuth: []
@@ -800,16 +800,16 @@ paths:
           type: integer
           format: int64
       responses:
-        "202":
-          description: Deleted message
-          content:
-            application/json: {}
         "404":
           description: Could not find message
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
+        "202":
+          description: Deleted message
+          content:
+            application/json: {}
       security:
       - bearerAuth: []
       - basicAuth: []
@@ -828,18 +828,18 @@ paths:
           type: integer
           format: int64
       responses:
-        "404":
-          description: Image could not be found
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
         "200":
           description: Found image
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ImageDto"
+        "404":
+          description: Image could not be found
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
     put:
       tags:
       - image-endpoint
@@ -929,20 +929,14 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "503":
-          description: Failed to find in data service
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
-        "404":
-          description: Identifier could not be found
+        "502":
+          description: Connection to data service failed
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "406":
-          description: Failed to find acceptable representation
+        "503":
+          description: Failed to find in data service
           content:
             application/json:
               schema:
@@ -975,8 +969,14 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "502":
-          description: Connection to data service failed
+        "404":
+          description: Identifier could not be found
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
+        "406":
+          description: Failed to find acceptable representation
           content:
             application/json:
               schema:
@@ -1004,12 +1004,18 @@ paths:
               $ref: "#/components/schemas/IdentifierSaveDto"
         required: true
       responses:
-        "202":
-          description: Saved identifier
+        "400":
+          description: Identifier form contains invalid request data
           content:
             application/json:
               schema:
-                $ref: "#/components/schemas/IdentifierDto"
+                $ref: "#/components/schemas/ApiErrorDto"
+        "404":
+          description: "Failed to find database, table or view"
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
         "403":
           description: Insufficient access rights or authorities
           content:
@@ -1028,18 +1034,12 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "400":
-          description: Identifier form contains invalid request data
+        "202":
+          description: Saved identifier
           content:
             application/json:
               schema:
-                $ref: "#/components/schemas/ApiErrorDto"
-        "404":
-          description: "Failed to find database, table or view"
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
+                $ref: "#/components/schemas/IdentifierDto"
       security:
       - bearerAuth: []
       - basicAuth: []
@@ -1063,14 +1063,6 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "502":
-          description: Connection to search service failed
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
-        "202":
-          description: Deleted identifier
         "404":
           description: Identifier or database could not be found
           content:
@@ -1083,6 +1075,14 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
+        "502":
+          description: Connection to search service failed
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
+        "202":
+          description: Deleted identifier
       security:
       - bearerAuth: []
       - basicAuth: []
@@ -1102,6 +1102,18 @@ paths:
           type: integer
           format: int64
       responses:
+        "400":
+          description: Identifier form contains invalid request data
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
+        "404":
+          description: "Failed to find database, table or view"
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
         "403":
           description: Insufficient access rights or authorities
           content:
@@ -1126,18 +1138,6 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/IdentifierDto"
-        "400":
-          description: Identifier form contains invalid request data
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
-        "404":
-          description: "Failed to find database, table or view"
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
       security:
       - bearerAuth: []
       - basicAuth: []
@@ -1169,32 +1169,32 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "403":
-          description: Visibility modification is not permitted
+        "202":
+          description: Visibility modified successfully
           content:
             application/json:
               schema:
-                $ref: "#/components/schemas/ApiErrorDto"
-        "404":
-          description: Failed to find database in metadata database
+                $ref: "#/components/schemas/DatabaseBriefDto"
+        "503":
+          description: Failed to save in search service
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "503":
-          description: Failed to save in search service
+        "502":
+          description: Connection to search service failed
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "202":
-          description: Visibility modified successfully
+        "404":
+          description: Failed to find database in metadata database
           content:
             application/json:
               schema:
-                $ref: "#/components/schemas/DatabaseBriefDto"
-        "502":
-          description: Connection to search service failed
+                $ref: "#/components/schemas/ApiErrorDto"
+        "403":
+          description: Visibility modification is not permitted
           content:
             application/json:
               schema:
@@ -1223,6 +1223,18 @@ paths:
           type: integer
           format: int64
       responses:
+        "403":
+          description: Find view is not permitted
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
+        "404":
+          description: "Database, view or user could not be found"
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
         "200":
           description: Find view successfully
           headers:
@@ -1254,18 +1266,6 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ViewDto"
-        "403":
-          description: Find view is not permitted
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
-        "404":
-          description: "Database, view or user could not be found"
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
       security:
       - bearerAuth: []
       - basicAuth: []
@@ -1296,12 +1296,6 @@ paths:
               $ref: "#/components/schemas/ViewUpdateDto"
         required: true
       responses:
-        "400":
-          description: Update view query is malformed
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
         "403":
           description: Update not allowed
           content:
@@ -1332,6 +1326,12 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
+        "400":
+          description: Update view query is malformed
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
       security:
       - bearerAuth: []
       - basicAuth: []
@@ -1357,8 +1357,14 @@ paths:
       responses:
         "202":
           description: Delete view successfully
-        "403":
-          description: Deletion not allowed
+        "423":
+          description: Delete view resulted in an invalid query statement
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
+        "404":
+          description: "Database, view or user could not be found"
           content:
             application/json:
               schema:
@@ -1381,14 +1387,8 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "423":
-          description: Delete view resulted in an invalid query statement
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
-        "404":
-          description: "Database, view or user could not be found"
+        "403":
+          description: Deletion not allowed
           content:
             application/json:
               schema:
@@ -1420,6 +1420,18 @@ paths:
           type: integer
           format: int64
       responses:
+        "502":
+          description: Failed to establish connection with broker service
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
+        "404":
+          description: "Table, database or container could not be found"
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
         "503":
           description: Failed to obtain queue information from broker service
           content:
@@ -1448,18 +1460,6 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "404":
-          description: "Table, database or container could not be found"
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
-        "502":
-          description: Failed to establish connection with broker service
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
       security:
       - bearerAuth: []
       - basicAuth: []
@@ -1495,18 +1495,6 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "403":
-          description: Update table visibility not permitted
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
-        "404":
-          description: Table could not be found
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
         "503":
           description: Failed to save in search service
           content:
@@ -1525,6 +1513,18 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/TableBriefDto"
+        "403":
+          description: Update table visibility not permitted
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
+        "404":
+          description: Table could not be found
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
       security:
       - bearerAuth: []
       - basicAuth: []
@@ -1558,12 +1558,6 @@ paths:
                 $ref: "#/components/schemas/ApiErrorDto"
         "202":
           description: Delete table successfully
-        "403":
-          description: Access to the database is forbidden
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
         "404":
           description: "Table, database or container could not be found"
           content:
@@ -1582,6 +1576,12 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
+        "403":
+          description: Access to the database is forbidden
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
       security:
       - bearerAuth: []
       - basicAuth: []
@@ -1608,6 +1608,12 @@ paths:
           type: integer
           format: int64
       responses:
+        "400":
+          description: Failed to map column statistic to known columns
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
         "503":
           description: Failed to save in search service
           content:
@@ -1632,12 +1638,6 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "400":
-          description: Failed to map column statistic to known columns
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
         "202":
           description: Updated table statistics successfully
       security:
@@ -1679,25 +1679,18 @@ paths:
               $ref: "#/components/schemas/ColumnSemanticsUpdateDto"
         required: true
       responses:
-        "400":
-          description: Update semantic concept query is malformed or update unit of
-            measurement query is malformed
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
-        "403":
-          description: Access to the database is forbidden
+        "503":
+          description: Failed to save in search service
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "503":
-          description: Failed to save in search service
+        "202":
+          description: Updated column semantics successfully
           content:
             application/json:
               schema:
-                $ref: "#/components/schemas/ApiErrorDto"
+                $ref: "#/components/schemas/ColumnDto"
         "404":
           description: Failed to find user/table/database/ontology in metadata database
           content:
@@ -1710,12 +1703,19 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "202":
-          description: Updated column semantics successfully
+        "400":
+          description: Update semantic concept query is malformed or update unit of
+            measurement query is malformed
           content:
             application/json:
               schema:
-                $ref: "#/components/schemas/ColumnDto"
+                $ref: "#/components/schemas/ApiErrorDto"
+        "403":
+          description: Access to the database is forbidden
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
       security:
       - bearerAuth: []
       - basicAuth: []
@@ -1747,18 +1747,6 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "403":
-          description: Transfer of ownership is not permitted
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
-        "404":
-          description: Database or user could not be found
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
         "202":
           description: Transfer of ownership was successful
           content:
@@ -1777,6 +1765,18 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
+        "403":
+          description: Transfer of ownership is not permitted
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
+        "404":
+          description: Database or user could not be found
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
       security:
       - bearerAuth: []
       - basicAuth: []
@@ -1797,12 +1797,6 @@ paths:
           type: integer
           format: int64
       responses:
-        "404":
-          description: Failed to find database in metadata database
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
         "200":
           description: Refreshed database views metadata
           content:
@@ -1827,6 +1821,12 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
+        "404":
+          description: Failed to find database in metadata database
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
       security:
       - bearerAuth: []
       - basicAuth: []
@@ -1853,14 +1853,14 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "403":
-          description: Not allowed to refresh table metadata
+        "503":
+          description: Failed to save in search service
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "404":
-          description: Failed to fin user/database in metadata database
+        "502":
+          description: Connection to search service failed
           content:
             application/json:
               schema:
@@ -1871,14 +1871,14 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/DatabaseBriefDto"
-        "503":
-          description: Failed to save in search service
+        "403":
+          description: Not allowed to refresh table metadata
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "502":
-          description: Connection to search service failed
+        "404":
+          description: Failed to fin user/database in metadata database
           content:
             application/json:
               schema:
@@ -1901,12 +1901,6 @@ paths:
           type: integer
           format: int64
       responses:
-        "404":
-          description: Database or user could not be found
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
         "200":
           description: View of image was successful
           content:
@@ -1916,6 +1910,12 @@ paths:
                 items:
                   type: string
                   format: byte
+        "404":
+          description: Database or user could not be found
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
       security:
       - bearerAuth: []
       - basicAuth: []
@@ -1945,19 +1945,7 @@ paths:
           content:
             application/json:
               schema:
-                $ref: "#/components/schemas/ApiErrorDto"
-        "410":
-          description: File was not found in the Storage Service
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
-        "202":
-          description: Modify of image was successful
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/DatabaseBriefDto"
+                $ref: "#/components/schemas/ApiErrorDto"
         "404":
           description: Database could not be found
           content:
@@ -1976,6 +1964,18 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
+        "202":
+          description: Modify of image was successful
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/DatabaseBriefDto"
+        "410":
+          description: File was not found in the Storage Service
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
       security:
       - bearerAuth: []
       - basicAuth: []
@@ -2017,22 +2017,6 @@ paths:
               $ref: "#/components/schemas/CreateUserDto"
         required: true
       responses:
-        "417":
-          description: User with e-mail already exists
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
-        "400":
-          description: Parameters are not well-formed (likely email)
-          content:
-            application/json: {}
-        "503":
-          description: Failed to create in auth service
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
         "201":
           description: Created user
           content:
@@ -2063,6 +2047,22 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
+        "400":
+          description: Parameters are not well-formed (likely email)
+          content:
+            application/json: {}
+        "417":
+          description: User with e-mail already exists
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
+        "503":
+          description: Failed to create in auth service
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
   /api/ontology:
     get:
       tags:
@@ -2274,38 +2274,38 @@ paths:
               $ref: "#/components/schemas/CreateIdentifierDto"
         required: true
       responses:
-        "403":
-          description: Insufficient access rights or authorities
+        "201":
+          description: Drafted identifier
           content:
             application/json:
               schema:
-                $ref: "#/components/schemas/ApiErrorDto"
-        "503":
-          description: Failed to save in search service
+                $ref: "#/components/schemas/IdentifierDto"
+        "400":
+          description: Identifier form contains invalid request data
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "502":
-          description: Connection to search service failed
+        "404":
+          description: "Failed to find database, table or view"
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "400":
-          description: Identifier form contains invalid request data
+        "403":
+          description: Insufficient access rights or authorities
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "201":
-          description: Drafted identifier
+        "503":
+          description: Failed to save in search service
           content:
             application/json:
               schema:
-                $ref: "#/components/schemas/IdentifierDto"
-        "404":
-          description: "Failed to find database, table or view"
+                $ref: "#/components/schemas/ApiErrorDto"
+        "502":
+          description: Connection to search service failed
           content:
             application/json:
               schema:
@@ -2328,12 +2328,6 @@ paths:
           type: integer
           format: int64
       responses:
-        "404":
-          description: Database or user could not be found
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
         "200":
           description: Find views successfully
           content:
@@ -2342,6 +2336,12 @@ paths:
                 type: array
                 items:
                   $ref: "#/components/schemas/ViewBriefDto"
+        "404":
+          description: Database or user could not be found
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
       security:
       - bearerAuth: []
       - basicAuth: []
@@ -2372,38 +2372,38 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ViewBriefDto"
-        "400":
-          description: Create view query is malformed
+        "423":
+          description: Create view resulted in an invalid query statement
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "403":
-          description: Credentials missing
+        "503":
+          description: Failed to save in search service
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "404":
-          description: Failed to find database/user in metadata database.
+        "502":
+          description: Connection to search service failed
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "503":
-          description: Failed to save in search service
+        "400":
+          description: Create view query is malformed
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "502":
-          description: Connection to search service failed
+        "403":
+          description: Credentials missing
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "423":
-          description: Create view resulted in an invalid query statement
+        "404":
+          description: Failed to find database/user in metadata database.
           content:
             application/json:
               schema:
@@ -2428,6 +2428,12 @@ paths:
           type: integer
           format: int64
       responses:
+        "403":
+          description: List tables not permitted
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
         "404":
           description: Database could not be found
           content:
@@ -2442,12 +2448,6 @@ paths:
                 type: array
                 items:
                   $ref: "#/components/schemas/TableBriefDto"
-        "403":
-          description: List tables not permitted
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
       security:
       - bearerAuth: []
       - basicAuth: []
@@ -2471,14 +2471,20 @@ paths:
               $ref: "#/components/schemas/CreateTableDto"
         required: true
       responses:
+        "409":
+          description: Create table conflicts with existing table name
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
         "400":
           description: Create table query is malformed
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "409":
-          description: Create table conflicts with existing table name
+        "404":
+          description: "Database, container or user could not be found"
           content:
             application/json:
               schema:
@@ -2507,12 +2513,6 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/TableBriefDto"
-        "404":
-          description: "Database, container or user could not be found"
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
       security:
       - bearerAuth: []
       - basicAuth: []
@@ -2564,12 +2564,6 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "404":
-          description: Container image or user could not be found
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
         "201":
           description: Created a new container
           content:
@@ -2582,6 +2576,12 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
+        "404":
+          description: Container image or user could not be found
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
       security:
       - bearerAuth: []
       - basicAuth: []
@@ -2639,14 +2639,6 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "200":
-          description: Found entities
-          content:
-            application/json:
-              schema:
-                type: array
-                items:
-                  $ref: "#/components/schemas/EntityDto"
         "404":
           description: Could not find ontology
           content:
@@ -2659,6 +2651,14 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
+        "200":
+          description: Found entities
+          content:
+            application/json:
+              schema:
+                type: array
+                items:
+                  $ref: "#/components/schemas/EntityDto"
       security:
       - bearerAuth: []
       - basicAuth: []
@@ -2766,6 +2766,18 @@ paths:
           type: integer
           format: int64
       responses:
+        "404":
+          description: "Database, user or exchange could not be found"
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
+        "403":
+          description: Not allowed to view database
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
         "200":
           description: Database found successfully
           headers:
@@ -2782,12 +2794,6 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/DatabaseBriefDto"
-        "404":
-          description: "Database, user or exchange could not be found"
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
         "503":
           description: Failed to find queue information in broker service
           content:
@@ -2800,12 +2806,6 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "403":
-          description: Not allowed to view database
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
       security:
       - bearerAuth: []
       - basicAuth: []
@@ -2843,12 +2843,6 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "400":
-          description: Failed to parse statistic in search service
-          content:
-            application/json:
-              schema:
-                $ref: "#/components/schemas/ApiErrorDto"
         "200":
           description: Suggested table semantics successfully
           content:
@@ -2857,14 +2851,20 @@ paths:
                 type: array
                 items:
                   $ref: "#/components/schemas/EntityDto"
+        "417":
+          description: Generated query is malformed
+          content:
+            application/json:
+              schema:
+                $ref: "#/components/schemas/ApiErrorDto"
         "404":
           description: Failed to find database/table in metadata database
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "417":
-          description: Generated query is malformed
+        "400":
+          description: Failed to parse statistic in search service
           content:
             application/json:
               schema:
@@ -2905,6 +2905,14 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
+        "200":
+          description: Suggested table column semantics successfully
+          content:
+            application/json:
+              schema:
+                type: array
+                items:
+                  $ref: "#/components/schemas/TableColumnEntityDto"
         "400":
           description: Generated query is malformed
           content:
@@ -2917,14 +2925,6 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "200":
-          description: Suggested table column semantics successfully
-          content:
-            application/json:
-              schema:
-                type: array
-                items:
-                  $ref: "#/components/schemas/TableColumnEntityDto"
       security:
       - bearerAuth: []
       - basicAuth: []
@@ -2975,14 +2975,14 @@ paths:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
-        "202":
-          description: Deleted container
         "404":
           description: Container not found
           content:
             application/json:
               schema:
                 $ref: "#/components/schemas/ApiErrorDto"
+        "202":
+          description: Deleted container
       security:
       - bearerAuth: []
       - basicAuth: []
@@ -3395,6 +3395,21 @@ components:
         family_name:
           type: string
           example: Carberry
+    DatabaseAccessDto:
+      required:
+      - type
+      - user
+      type: object
+      properties:
+        user:
+          $ref: "#/components/schemas/UserBriefDto"
+        type:
+          type: string
+          example: read
+          enum:
+          - read
+          - write_own
+          - write_all
     ApiErrorDto:
       required:
       - code
@@ -3481,21 +3496,6 @@ components:
         code:
           type: string
           example: error.service.code
-    DatabaseAccessDto:
-      required:
-      - type
-      - user
-      type: object
-      properties:
-        user:
-          $ref: "#/components/schemas/UserBriefDto"
-        type:
-          type: string
-          example: read
-          enum:
-          - read
-          - write_own
-          - write_all
     UserUpdateDto:
       required:
       - language
diff --git a/.docs/.openapi/api.yaml b/.docs/.openapi/api.yaml
index 3338c9d6a281bfd4dab7ee378b1ce08d1f3d8f96..c5d75bca5ae848f542e636fe91d656195e2dc6b2 100644
--- a/.docs/.openapi/api.yaml
+++ b/.docs/.openapi/api.yaml
@@ -16,7 +16,7 @@ info:
     name: Apache 2.0
     url: 'https://www.apache.org/licenses/LICENSE-2.0'
   title: DBRepo REST API
-  version: 1.6.1
+  version: 1.6.2
 servers:
   - description: Test Instance
     url: 'https://test.dbrepo.tuwien.ac.at'
@@ -710,6 +710,12 @@ paths:
           schema:
             type: integer
             format: int64
+        - name: timestamp
+          in: query
+          required: false
+          schema:
+            type: string
+            format: date-time
         - name: page
           in: query
           required: false
@@ -797,6 +803,12 @@ paths:
           schema:
             type: integer
             format: int64
+        - name: timestamp
+          in: query
+          required: false
+          schema:
+            type: string
+            format: date-time
         - name: page
           in: query
           required: false
@@ -1456,7 +1468,7 @@ paths:
         content:
           application/json:
             schema:
-              $ref: '#/components/schemas/DatabaseCreateDto'
+              $ref: '#/components/schemas/CreateDatabaseDto'
         required: true
       responses:
         '201':
@@ -2713,7 +2725,7 @@ paths:
           content:
             '*/*':
               schema:
-                $ref: '#/components/schemas/ViewDto'
+                $ref: '#/components/schemas/ViewBriefDto'
         '400':
           description: Update view query is malformed
           content:
@@ -2769,10 +2781,6 @@ paths:
       responses:
         '202':
           description: Delete view successfully
-          content:
-            '*/*':
-              schema:
-                type: object
         '400':
           description: Delete view query is malformed
           content:
@@ -2843,27 +2851,12 @@ paths:
             X-Username:
               description: The authentication username
               style: simple
-            X-Table:
-              description: The table internal name
-              style: simple
             Access-Control-Expose-Headers:
               description: Expose custom headers
               style: simple
-            X-Type:
-              description: The JDBC connection type
-              style: simple
-            X-Database:
-              description: The database internal name
-              style: simple
             X-Password:
               description: The authentication password
               style: simple
-            X-Host:
-              description: The database hostname
-              style: simple
-            X-Port:
-              description: The database port number
-              style: simple
           content:
             application/json:
               schema:
@@ -3457,7 +3450,7 @@ paths:
         content:
           application/json:
             schema:
-              $ref: '#/components/schemas/SignupRequestDto'
+              $ref: '#/components/schemas/CreateUserDto'
         required: true
       responses:
         '201':
@@ -3720,7 +3713,7 @@ paths:
         content:
           application/json:
             schema:
-              $ref: '#/components/schemas/IdentifierCreateDto'
+              $ref: '#/components/schemas/CreateIdentifierDto'
         required: true
       responses:
         '201':
@@ -3813,7 +3806,7 @@ paths:
         content:
           application/json:
             schema:
-              $ref: '#/components/schemas/ViewCreateDto'
+              $ref: '#/components/schemas/CreateViewDto'
         required: true
       responses:
         '201':
@@ -3919,7 +3912,7 @@ paths:
         content:
           application/json:
             schema:
-              $ref: '#/components/schemas/TableCreateDto'
+              $ref: '#/components/schemas/CreateTableDto'
         required: true
       responses:
         '201':
@@ -5410,24 +5403,10 @@ components:
       required:
         - attributes
         - id
+        - password
+        - username
       type: object
       properties:
-        jdbcMethod:
-          type: string
-          example: mariadb
-        host:
-          type: string
-          example: data-db
-        port:
-          type: integer
-          format: int32
-          example: 3306
-        username:
-          type: string
-          example: username
-        database:
-          type: string
-          example: air_quality
         id:
           type: string
           format: uuid
@@ -5435,6 +5414,12 @@ components:
         name:
           type: string
           example: Josiah Carberry
+        username:
+          type: string
+          example: username
+        password:
+          type: string
+          example: p4ssw0rd
         attributes:
           $ref: '#/components/schemas/UserAttributesDto'
         last_retrieved:
@@ -5754,105 +5739,53 @@ components:
         display_name:
           type: string
           example: XOR
-    CreatorSaveDto:
-      required:
-        - creator_name
-        - id
-      type: object
-      properties:
-        id:
-          type: integer
-          format: int64
-          example: 1
-        firstname:
-          type: string
-          example: Josiah
-        lastname:
-          type: string
-          example: Carberry
-        affiliation:
-          type: string
-          example: Wesleyan University
-        creator_name:
-          type: string
-          example: 'Carberry, Josiah'
-        name_type:
-          type: string
-          example: Personal
-          enum:
-            - Personal
-            - Organizational
-        name_identifier:
-          type: string
-          example: 0000-0002-1825-0097
-        name_identifier_scheme:
-          type: string
-          example: ORCID
-          enum:
-            - ORCID
-            - ROR
-            - ISNI
-            - GRID
-        affiliation_identifier:
-          type: string
-          example: 'https://ror.org/04d836q62'
-        affiliation_identifier_scheme:
-          type: string
-          example: ROR
-          enum:
-            - ROR
-            - GRID
-            - ISNI
-    IdentifierFunderSaveDto:
+    IdentifierSaveDto:
       required:
-        - funder_name
+        - creators
+        - database_id
         - id
+        - publication_year
+        - publisher
+        - titles
+        - type
       type: object
       properties:
         id:
           type: integer
           format: int64
           example: 1
-        funder_name:
-          type: string
-          example: European Commission
-        funder_identifier:
-          type: string
-          example: 'http://doi.org/10.13039/501100000780'
-        funder_identifier_type:
+        type:
           type: string
-          example: Crossref Funder ID
+          example: database
           enum:
-            - Crossref Funder ID
-            - ROR
-            - GND
-            - ISNI
-            - Other
-        scheme_uri:
-          type: string
-          example: 'http://doi.org/'
-        award_number:
-          type: string
-          example: '824087'
-        award_title:
+            - database
+            - subset
+            - table
+            - view
+        doi:
           type: string
-          example: EOSC-Life
-    IdentifierSaveDescriptionDto:
-      required:
-        - description
-        - id
-      type: object
-      properties:
-        id:
-          type: integer
-          format: int64
-          example: 1
-        description:
+          example: 10.1111/11111111
+        titles:
+          type: array
+          items:
+            $ref: '#/components/schemas/SaveIdentifierTitleDto'
+        descriptions:
+          type: array
+          items:
+            $ref: '#/components/schemas/SaveIdentifierDescriptionDto'
+        funders:
+          type: array
+          items:
+            $ref: '#/components/schemas/SaveIdentifierFunderDto'
+        licenses:
+          type: array
+          items:
+            $ref: '#/components/schemas/LicenseDto'
+        publisher:
           type: string
-          example: 'Air quality reports at Stephansplatz, Vienna'
+          example: TU Wien
         language:
           type: string
-          example: en
           enum:
             - ab
             - aa
@@ -6038,63 +5971,123 @@ components:
             - yo
             - za
             - zu
-        type:
+        creators:
+          type: array
+          items:
+            $ref: '#/components/schemas/SaveIdentifierCreatorDto'
+        database_id:
+          type: integer
+          format: int64
+          example: 1
+        query_id:
+          type: integer
+          format: int64
+        view_id:
+          type: integer
+          format: int64
+        table_id:
+          type: integer
+          format: int64
+        publication_day:
+          type: integer
+          format: int32
+          example: 15
+        publication_month:
+          type: integer
+          format: int32
+          example: 12
+        publication_year:
+          type: integer
+          format: int32
+          example: 2022
+        related_identifiers:
+          type: array
+          items:
+            $ref: '#/components/schemas/SaveRelatedIdentifierDto'
+    LicenseDto:
+      required:
+        - identifier
+        - uri
+      type: object
+      properties:
+        identifier:
           type: string
-          example: Abstract
-          enum:
-            - Abstract
-            - Methods
-            - SeriesInformation
-            - TableOfContents
-            - TechnicalInfo
-            - Other
-    IdentifierSaveDto:
+          example: MIT
+        uri:
+          type: string
+          example: 'https://opensource.org/licenses/MIT'
+        description:
+          type: string
+          example: >-
+            A short and simple permissive license with conditions only requiring
+            preservation of copyright and license notices. Licensed works,
+            modifications, and larger works may be distributed under different
+            terms and without source code.
+    SaveIdentifierCreatorDto:
       required:
-        - creators
-        - database_id
+        - creator_name
         - id
-        - publication_year
-        - publisher
-        - titles
-        - type
       type: object
       properties:
         id:
           type: integer
           format: int64
           example: 1
-        type:
+        firstname:
           type: string
-          example: database
+          example: Josiah
+        lastname:
+          type: string
+          example: Carberry
+        affiliation:
+          type: string
+          example: Wesleyan University
+        creator_name:
+          type: string
+          example: 'Carberry, Josiah'
+        name_type:
+          type: string
+          example: Personal
           enum:
-            - database
-            - subset
-            - table
-            - view
-        doi:
+            - Personal
+            - Organizational
+        name_identifier:
           type: string
-          example: 10.1111/11111111
-        titles:
-          type: array
-          items:
-            $ref: '#/components/schemas/IdentifierSaveTitleDto'
-        descriptions:
-          type: array
-          items:
-            $ref: '#/components/schemas/IdentifierSaveDescriptionDto'
-        funders:
-          type: array
-          items:
-            $ref: '#/components/schemas/IdentifierFunderSaveDto'
-        licenses:
-          type: array
-          items:
-            $ref: '#/components/schemas/LicenseDto'
-        publisher:
+          example: 0000-0002-1825-0097
+        name_identifier_scheme:
           type: string
-          example: TU Wien
+          example: ORCID
+          enum:
+            - ORCID
+            - ROR
+            - ISNI
+            - GRID
+        affiliation_identifier:
+          type: string
+          example: 'https://ror.org/04d836q62'
+        affiliation_identifier_scheme:
+          type: string
+          example: ROR
+          enum:
+            - ROR
+            - GRID
+            - ISNI
+    SaveIdentifierDescriptionDto:
+      required:
+        - description
+        - id
+      type: object
+      properties:
+        id:
+          type: integer
+          format: int64
+          example: 1
+        description:
+          type: string
+          example: 'Air quality reports at Stephansplatz, Vienna'
         language:
           type: string
+          example: en
           enum:
             - ab
             - aa
@@ -6280,40 +6273,51 @@ components:
             - yo
             - za
             - zu
-        creators:
-          type: array
-          items:
-            $ref: '#/components/schemas/CreatorSaveDto'
-        database_id:
+        type:
+          type: string
+          example: Abstract
+          enum:
+            - Abstract
+            - Methods
+            - SeriesInformation
+            - TableOfContents
+            - TechnicalInfo
+            - Other
+    SaveIdentifierFunderDto:
+      required:
+        - funder_name
+        - id
+      type: object
+      properties:
+        id:
           type: integer
           format: int64
           example: 1
-        query_id:
-          type: integer
-          format: int64
-        view_id:
-          type: integer
-          format: int64
-        table_id:
-          type: integer
-          format: int64
-        publication_day:
-          type: integer
-          format: int32
-          example: 15
-        publication_month:
-          type: integer
-          format: int32
-          example: 12
-        publication_year:
-          type: integer
-          format: int32
-          example: 2022
-        related_identifiers:
-          type: array
-          items:
-            $ref: '#/components/schemas/RelatedIdentifierSaveDto'
-    IdentifierSaveTitleDto:
+        funder_name:
+          type: string
+          example: European Commission
+        funder_identifier:
+          type: string
+          example: 'http://doi.org/10.13039/501100000780'
+        funder_identifier_type:
+          type: string
+          example: Crossref Funder ID
+          enum:
+            - Crossref Funder ID
+            - ROR
+            - GND
+            - ISNI
+            - Other
+        scheme_uri:
+          type: string
+          example: 'http://doi.org/'
+        award_number:
+          type: string
+          example: '824087'
+        award_title:
+          type: string
+          example: EOSC-Life
+    SaveIdentifierTitleDto:
       required:
         - id
         - title
@@ -6522,26 +6526,7 @@ components:
             - Subtitle
             - TranslatedTitle
             - Other
-    LicenseDto:
-      required:
-        - identifier
-        - uri
-      type: object
-      properties:
-        identifier:
-          type: string
-          example: MIT
-        uri:
-          type: string
-          example: 'https://opensource.org/licenses/MIT'
-        description:
-          type: string
-          example: >-
-            A short and simple permissive license with conditions only requiring
-            preservation of copyright and license notices. Licensed works,
-            modifications, and larger works may be distributed under different
-            terms and without source code.
-    RelatedIdentifierSaveDto:
+    SaveRelatedIdentifierDto:
       required:
         - id
         - relation
@@ -7323,196 +7308,77 @@ components:
         is_schema_public:
           type: boolean
           example: true
-    ViewColumnDto:
+    ViewBriefDto:
       required:
         - database_id
         - id
         - internal_name
-        - is_null_allowed
         - name
-        - ord
-        - type
+        - query
+        - query_hash
       type: object
       properties:
         id:
           type: integer
           format: int64
-          example: 12
+          example: 4
         name:
-          maxLength: 64
-          minLength: 0
           type: string
-          example: Given Name
-        size:
-          type: integer
-          format: int64
-          example: 255
-        d:
-          type: integer
-          format: int64
-          example: 0
-        description:
-          maxLength: 2048
-          minLength: 0
+          example: Air Quality
+        query:
           type: string
-          example: Column comment
+          example: SELECT `id` FROM `air_quality` ORDER BY `value` DESC
         database_id:
           type: integer
           format: int64
           example: 1
-        ord:
-          type: integer
-          format: int32
-          example: 0
         internal_name:
-          maxLength: 64
-          minLength: 0
           type: string
-          example: given_name
-        index_length:
-          type: integer
-          format: int64
-          example: 255
-        length:
-          type: integer
-          format: int64
-          example: 255
-        type:
+          example: air_quality
+        is_public:
+          type: boolean
+          example: true
+        is_schema_public:
+          type: boolean
+          example: true
+        initial_view:
+          type: boolean
+          description: True if it is the default view for the database
+          example: true
+        query_hash:
           type: string
-          example: varchar
-          enum:
-            - char
-            - varchar
-            - binary
-            - varbinary
-            - tinyblob
-            - tinytext
-            - text
-            - blob
-            - mediumtext
-            - mediumblob
-            - longtext
-            - longblob
-            - enum
-            - set
-            - serial
-            - bit
-            - tinyint
-            - bool
-            - smallint
-            - mediumint
-            - int
-            - bigint
-            - float
-            - double
-            - decimal
-            - date
-            - datetime
-            - timestamp
-            - time
-            - year
-        is_null_allowed:
+          example: 7de03e818900b6ea6d58ad0306d4a741d658c6df3d1964e89ed2395d8c7e7916
+        owned_by:
+          type: string
+          format: uuid
+          example: ac750fcf-ea02-4fce-85ac-d73857e18b35
+    TableUpdateDto:
+      required:
+        - is_public
+        - is_schema_public
+      type: object
+      properties:
+        description:
+          maxLength: 180
+          minLength: 0
+          type: string
+          example: Air Quality in Austria
+        is_public:
           type: boolean
-          example: false
-    ViewDto:
+          example: true
+        is_schema_public:
+          type: boolean
+          example: true
+    TableBriefDto:
       required:
-        - columns
         - database_id
         - id
-        - identifiers
         - internal_name
+        - is_public
+        - is_schema_public
+        - is_versioned
         - name
-        - owner
-        - query
-        - query_hash
-      type: object
-      properties:
-        jdbcMethod:
-          type: string
-          example: mariadb
-        host:
-          type: string
-          example: data-db
-        port:
-          type: integer
-          format: int32
-          example: 3306
-        username:
-          type: string
-          example: username
-        database:
-          type: string
-          example: air_quality
-        id:
-          type: integer
-          format: int64
-          example: 4
-        name:
-          type: string
-          example: Air Quality
-        identifiers:
-          type: array
-          items:
-            $ref: '#/components/schemas/IdentifierDto'
-        query:
-          type: string
-          example: SELECT `id` FROM `air_quality` ORDER BY `value` DESC
-        owner:
-          $ref: '#/components/schemas/UserBriefDto'
-        columns:
-          type: array
-          items:
-            $ref: '#/components/schemas/ViewColumnDto'
-        last_retrieved:
-          type: string
-          format: date-time
-        database_id:
-          type: integer
-          format: int64
-          example: 1
-        internal_name:
-          type: string
-          example: air_quality
-        is_public:
-          type: boolean
-          example: true
-        is_schema_public:
-          type: boolean
-          example: true
-        initial_view:
-          type: boolean
-          description: True if it is the default view for the database
-          example: true
-        query_hash:
-          type: string
-          example: 7de03e818900b6ea6d58ad0306d4a741d658c6df3d1964e89ed2395d8c7e7916
-    TableUpdateDto:
-      required:
-        - is_public
-        - is_schema_public
-      type: object
-      properties:
-        description:
-          maxLength: 180
-          minLength: 0
-          type: string
-          example: Air Quality in Austria
-        is_public:
-          type: boolean
-          example: true
-        is_schema_public:
-          type: boolean
-          example: true
-    TableBriefDto:
-      required:
-        - database_id
-        - id
-        - internal_name
-        - is_public
-        - is_schema_public
-        - is_versioned
-        - name
-        - owned_by
+        - owned_by
       type: object
       properties:
         id:
@@ -7761,7 +7627,7 @@ components:
             - read
             - write_own
             - write_all
-    SignupRequestDto:
+    CreateUserDto:
       required:
         - email
         - password
@@ -7866,7 +7732,7 @@ components:
           minimum: 1024
           type: integer
           format: int32
-    IdentifierCreateDto:
+    CreateIdentifierDto:
       required:
         - creators
         - database_id
@@ -7890,15 +7756,15 @@ components:
         titles:
           type: array
           items:
-            $ref: '#/components/schemas/IdentifierSaveTitleDto'
+            $ref: '#/components/schemas/SaveIdentifierTitleDto'
         descriptions:
           type: array
           items:
-            $ref: '#/components/schemas/IdentifierSaveDescriptionDto'
+            $ref: '#/components/schemas/SaveIdentifierDescriptionDto'
         funders:
           type: array
           items:
-            $ref: '#/components/schemas/IdentifierFunderSaveDto'
+            $ref: '#/components/schemas/SaveIdentifierFunderDto'
         licenses:
           type: array
           items:
@@ -8096,7 +7962,7 @@ components:
         creators:
           type: array
           items:
-            $ref: '#/components/schemas/CreatorSaveDto'
+            $ref: '#/components/schemas/SaveIdentifierCreatorDto'
         database_id:
           type: integer
           format: int64
@@ -8125,8 +7991,8 @@ components:
         related_identifiers:
           type: array
           items:
-            $ref: '#/components/schemas/RelatedIdentifierSaveDto'
-    DatabaseCreateDto:
+            $ref: '#/components/schemas/SaveRelatedIdentifierDto'
+    CreateDatabaseDto:
       required:
         - container_id
         - is_public
@@ -8147,7 +8013,7 @@ components:
         is_schema_public:
           type: boolean
           example: true
-    ViewCreateDto:
+    CreateViewDto:
       required:
         - is_public
         - is_schema_public
@@ -8169,51 +8035,40 @@ components:
         is_schema_public:
           type: boolean
           example: true
-    ViewBriefDto:
+    CreateForeignKeyDto:
       required:
-        - database_id
-        - id
-        - internal_name
-        - name
-        - query
-        - query_hash
+        - columns
+        - referenced_columns
+        - referenced_table
       type: object
       properties:
-        id:
-          type: integer
-          format: int64
-          example: 4
-        name:
-          type: string
-          example: Air Quality
-        query:
-          type: string
-          example: SELECT `id` FROM `air_quality` ORDER BY `value` DESC
-        database_id:
-          type: integer
-          format: int64
-          example: 1
-        internal_name:
+        columns:
+          type: array
+          items:
+            type: string
+        referenced_table:
           type: string
-          example: air_quality
-        is_public:
-          type: boolean
-          example: true
-        is_schema_public:
-          type: boolean
-          example: true
-        initial_view:
-          type: boolean
-          description: True if it is the default view for the database
-          example: true
-        query_hash:
+        referenced_columns:
+          type: array
+          items:
+            type: string
+        on_update:
           type: string
-          example: 7de03e818900b6ea6d58ad0306d4a741d658c6df3d1964e89ed2395d8c7e7916
-        owned_by:
+          enum:
+            - restrict
+            - cascade
+            - set_null
+            - no_action
+            - set_default
+        on_delete:
           type: string
-          format: uuid
-          example: ac750fcf-ea02-4fce-85ac-d73857e18b35
-    ColumnCreateDto:
+          enum:
+            - restrict
+            - cascade
+            - set_null
+            - no_action
+            - set_default
+    CreateTableColumnDto:
       required:
         - name
         - null_allowed
@@ -8292,7 +8147,7 @@ components:
           type: string
         unit_uri:
           type: string
-    ConstraintsCreateDto:
+    CreateTableConstraintsDto:
       required:
         - checks
         - foreign_keys
@@ -8314,46 +8169,13 @@ components:
         foreign_keys:
           type: array
           items:
-            $ref: '#/components/schemas/ForeignKeyCreateDto'
+            $ref: '#/components/schemas/CreateForeignKeyDto'
         primary_key:
           uniqueItems: true
           type: array
           items:
             type: string
-    ForeignKeyCreateDto:
-      required:
-        - columns
-        - referenced_columns
-        - referenced_table
-      type: object
-      properties:
-        columns:
-          type: array
-          items:
-            type: string
-        referenced_table:
-          type: string
-        referenced_columns:
-          type: array
-          items:
-            type: string
-        on_update:
-          type: string
-          enum:
-            - restrict
-            - cascade
-            - set_null
-            - no_action
-            - set_default
-        on_delete:
-          type: string
-          enum:
-            - restrict
-            - cascade
-            - set_null
-            - no_action
-            - set_default
-    TableCreateDto:
+    CreateTableDto:
       required:
         - columns
         - constraints
@@ -8375,9 +8197,9 @@ components:
         columns:
           type: array
           items:
-            $ref: '#/components/schemas/ColumnCreateDto'
+            $ref: '#/components/schemas/CreateTableColumnDto'
         constraints:
-          $ref: '#/components/schemas/ConstraintsCreateDto'
+          $ref: '#/components/schemas/CreateTableConstraintsDto'
         is_public:
           type: boolean
           example: true
@@ -8440,9 +8262,13 @@ components:
         - quota
       type: object
       properties:
-        jdbcMethod:
+        id:
+          type: integer
+          format: int64
+          example: 4
+        name:
           type: string
-          example: mariadb
+          example: Air Quality
         host:
           type: string
           example: data-db
@@ -8450,19 +8276,6 @@ components:
           type: integer
           format: int32
           example: 3306
-        username:
-          type: string
-          example: username
-        database:
-          type: string
-          example: air_quality
-        id:
-          type: integer
-          format: int64
-          example: 4
-        name:
-          type: string
-          example: Air Quality
         image:
           $ref: '#/components/schemas/ImageDto'
         quota:
@@ -8473,6 +8286,12 @@ components:
           type: integer
           format: int64
           example: 10
+        username:
+          type: string
+          example: username
+        password:
+          type: string
+          example: p4ssw0rd
         last_retrieved:
           type: string
           format: date-time
@@ -8782,6 +8601,79 @@ components:
           type: array
           items:
             $ref: '#/components/schemas/PrimaryKeyDto'
+    DatabaseDto:
+      required:
+        - accesses
+        - contact
+        - exchange_name
+        - id
+        - identifiers
+        - internal_name
+        - is_public
+        - is_schema_public
+        - name
+        - owner
+        - subsets
+        - tables
+        - views
+      type: object
+      properties:
+        id:
+          type: integer
+          format: int64
+          example: 3
+        name:
+          type: string
+          example: Air Quality
+        description:
+          type: string
+          example: Air Quality
+        tables:
+          type: array
+          items:
+            $ref: '#/components/schemas/TableDto'
+        views:
+          type: array
+          items:
+            $ref: '#/components/schemas/ViewDto'
+        container:
+          $ref: '#/components/schemas/ContainerDto'
+        accesses:
+          type: array
+          items:
+            $ref: '#/components/schemas/DatabaseAccessDto'
+        identifiers:
+          type: array
+          items:
+            $ref: '#/components/schemas/IdentifierDto'
+        subsets:
+          type: array
+          items:
+            $ref: '#/components/schemas/IdentifierDto'
+        contact:
+          $ref: '#/components/schemas/UserBriefDto'
+        owner:
+          $ref: '#/components/schemas/UserBriefDto'
+        last_retrieved:
+          type: string
+          format: date-time
+        exchange_name:
+          type: string
+          example: dbrepo
+        exchange_type:
+          type: string
+          example: topic
+        internal_name:
+          type: string
+          example: air_quality
+        is_public:
+          type: boolean
+          example: true
+        is_schema_public:
+          type: boolean
+          example: true
+        preview_image:
+          type: string
     ForeignKeyBriefDto:
       type: object
       properties:
@@ -8877,22 +8769,6 @@ components:
         - routing_key
       type: object
       properties:
-        jdbcMethod:
-          type: string
-          example: mariadb
-        host:
-          type: string
-          example: data-db
-        port:
-          type: integer
-          format: int32
-          example: 3306
-        username:
-          type: string
-          example: username
-        database:
-          type: string
-          example: air_quality
         id:
           type: integer
           format: int64
@@ -8918,6 +8794,8 @@ components:
           type: array
           items:
             $ref: '#/components/schemas/ColumnDto'
+        database:
+          $ref: '#/components/schemas/DatabaseDto'
         constraints:
           $ref: '#/components/schemas/ConstraintsDto'
         last_retrieved:
@@ -8988,6 +8866,155 @@ components:
           type: array
           items:
             $ref: '#/components/schemas/ColumnBriefDto'
+    ViewColumnDto:
+      required:
+        - database_id
+        - id
+        - internal_name
+        - is_null_allowed
+        - name
+        - ord
+        - type
+      type: object
+      properties:
+        id:
+          type: integer
+          format: int64
+          example: 12
+        name:
+          maxLength: 64
+          minLength: 0
+          type: string
+          example: Given Name
+        size:
+          type: integer
+          format: int64
+          example: 255
+        d:
+          type: integer
+          format: int64
+          example: 0
+        description:
+          maxLength: 2048
+          minLength: 0
+          type: string
+          example: Column comment
+        database_id:
+          type: integer
+          format: int64
+          example: 1
+        ord:
+          type: integer
+          format: int32
+          example: 0
+        internal_name:
+          maxLength: 64
+          minLength: 0
+          type: string
+          example: given_name
+        index_length:
+          type: integer
+          format: int64
+          example: 255
+        length:
+          type: integer
+          format: int64
+          example: 255
+        type:
+          type: string
+          example: varchar
+          enum:
+            - char
+            - varchar
+            - binary
+            - varbinary
+            - tinyblob
+            - tinytext
+            - text
+            - blob
+            - mediumtext
+            - mediumblob
+            - longtext
+            - longblob
+            - enum
+            - set
+            - serial
+            - bit
+            - tinyint
+            - bool
+            - smallint
+            - mediumint
+            - int
+            - bigint
+            - float
+            - double
+            - decimal
+            - date
+            - datetime
+            - timestamp
+            - time
+            - year
+        is_null_allowed:
+          type: boolean
+          example: false
+    ViewDto:
+      required:
+        - columns
+        - database_id
+        - id
+        - identifiers
+        - internal_name
+        - name
+        - owner
+        - query
+        - query_hash
+      type: object
+      properties:
+        id:
+          type: integer
+          format: int64
+          example: 4
+        name:
+          type: string
+          example: Air Quality
+        identifiers:
+          type: array
+          items:
+            $ref: '#/components/schemas/IdentifierDto'
+        query:
+          type: string
+          example: SELECT `id` FROM `air_quality` ORDER BY `value` DESC
+        database:
+          $ref: '#/components/schemas/DatabaseDto'
+        owner:
+          $ref: '#/components/schemas/UserBriefDto'
+        columns:
+          type: array
+          items:
+            $ref: '#/components/schemas/ViewColumnDto'
+        last_retrieved:
+          type: string
+          format: date-time
+        database_id:
+          type: integer
+          format: int64
+          example: 1
+        internal_name:
+          type: string
+          example: air_quality
+        is_public:
+          type: boolean
+          example: true
+        is_schema_public:
+          type: boolean
+          example: true
+        initial_view:
+          type: boolean
+          description: True if it is the default view for the database
+          example: true
+        query_hash:
+          type: string
+          example: 7de03e818900b6ea6d58ad0306d4a741d658c6df3d1964e89ed2395d8c7e7916
     TableColumnEntityDto:
       required:
         - column_id
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 878502f1bc31776f208fe4af1a085d2af8e2705c..90cb9846b23f79ed4feb1d36e887886b88ad1a06 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
@@ -1,6 +1,7 @@
 package at.tuwien.endpoints;
 
 import at.tuwien.ExportResourceDto;
+import at.tuwien.api.database.CreateViewDto;
 import at.tuwien.api.database.DatabaseDto;
 import at.tuwien.api.database.ViewColumnDto;
 import at.tuwien.api.database.ViewDto;
@@ -163,8 +164,7 @@ public class SubsetEndpoint extends RestEndpoint {
                                       Principal principal)
             throws DatabaseUnavailableException, DatabaseNotFoundException, RemoteUnavailableException,
             QueryNotFoundException, FormatNotAvailableException, StorageUnavailableException, UserNotFoundException,
-            MetadataServiceException, TableNotFoundException, ViewMalformedException, QueryMalformedException,
-            NotAllowedException {
+            MetadataServiceException, TableNotFoundException, QueryMalformedException, NotAllowedException {
         log.debug("endpoint find subset in database, databaseId={}, subsetId={}, accept={}, timestamp={}", databaseId,
                 subsetId, accept, timestamp);
         final DatabaseDto database = credentialService.getDatabase(databaseId);
@@ -341,7 +341,7 @@ public class SubsetEndpoint extends RestEndpoint {
                                                              @RequestParam(required = false) Long size)
             throws PaginationException, DatabaseNotFoundException, RemoteUnavailableException, NotAllowedException,
             QueryNotFoundException, DatabaseUnavailableException, TableMalformedException, QueryMalformedException,
-            UserNotFoundException, MetadataServiceException, TableNotFoundException, ViewNotFoundException {
+            UserNotFoundException, MetadataServiceException, TableNotFoundException, ViewNotFoundException, ViewMalformedException {
         log.debug("endpoint get subset data, databaseId={}, subsetId={}, principal.name={} page={}, size={}",
                 databaseId, subsetId, principal != null ? principal.getName() : null, page, size);
         endpointValidator.validateDataParams(page, size);
@@ -383,6 +383,12 @@ public class SubsetEndpoint extends RestEndpoint {
             final Dataset<Row> dataset = subsetService.getData(database, query, timestamp, page, size, null, null);
             metricsService.countSubsetGetData(databaseId, subsetId);
             final String viewName = metadataMapper.queryDtoToViewName(subset);
+            databaseService.createView(database, CreateViewDto.builder()
+                    .name(viewName)
+                    .isPublic(false)
+                    .isSchemaPublic(false)
+                    .query(query)
+                    .build());
             final ViewDto view = databaseService.inspectView(database, viewName);
             headers.set("Access-Control-Expose-Headers", "X-Id X-Headers");
             headers.set("X-Headers", String.join(",", view.getColumns().stream().map(ViewColumnDto::getInternalName).toList()));
diff --git a/dbrepo-data-service/rest-service/src/main/java/at/tuwien/validation/EndpointValidator.java b/dbrepo-data-service/rest-service/src/main/java/at/tuwien/validation/EndpointValidator.java
index 18307b5ac21d685ccf40adea4fc75d7a2cce290f..9ad13f5be68bf6714f5d18fec4973fe9898b38f6 100644
--- a/dbrepo-data-service/rest-service/src/main/java/at/tuwien/validation/EndpointValidator.java
+++ b/dbrepo-data-service/rest-service/src/main/java/at/tuwien/validation/EndpointValidator.java
@@ -6,7 +6,7 @@ import at.tuwien.api.database.DatabaseDto;
 import at.tuwien.config.QueryConfig;
 import at.tuwien.endpoints.RestEndpoint;
 import at.tuwien.exception.*;
-import at.tuwien.gateway.MetadataServiceGateway;
+import at.tuwien.service.CredentialService;
 import lombok.extern.log4j.Log4j2;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -24,12 +24,12 @@ import java.util.regex.Pattern;
 public class EndpointValidator extends RestEndpoint {
 
     private final QueryConfig queryConfig;
-    private final MetadataServiceGateway metadataServiceGateway;
+    private final CredentialService credentialService;
 
     @Autowired
-    public EndpointValidator(QueryConfig queryConfig, MetadataServiceGateway metadataServiceGateway) {
+    public EndpointValidator(QueryConfig queryConfig, CredentialService credentialService) {
         this.queryConfig = queryConfig;
-        this.metadataServiceGateway = metadataServiceGateway;
+        this.credentialService = credentialService;
     }
 
     public void validateDataParams(Long page, Long size) throws PaginationException {
@@ -90,7 +90,7 @@ public class EndpointValidator extends RestEndpoint {
         if (isSystem(principal)) {
             return;
         }
-        final DatabaseAccessDto access = metadataServiceGateway.getAccess(database.getId(), getId(principal));
+        final DatabaseAccessDto access = credentialService.getAccess(database.getId(), getId(principal));
         log.trace("found access: {}", access);
         if (writeAccessOnly && !(access.getType().equals(AccessTypeDto.WRITE_OWN) || access.getType().equals(AccessTypeDto.WRITE_ALL))) {
             log.error("Access not allowed: no write access");
diff --git a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/endpoint/AccessEndpointUnitTest.java b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/endpoint/AccessEndpointUnitTest.java
index 3cecdb64570a6c9de282964a0ee07a220135360a..3cbdf09af1f7705b2dd3fa550c24770618ba99d1 100644
--- a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/endpoint/AccessEndpointUnitTest.java
+++ b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/endpoint/AccessEndpointUnitTest.java
@@ -51,7 +51,7 @@ public class AccessEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_1_ID))
-                .thenReturn(DATABASE_1_DTO);
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
         when(credentialService.getUser(USER_4_ID))
                 .thenReturn(USER_4_DTO);
 
@@ -68,7 +68,7 @@ public class AccessEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_1_ID))
-                .thenReturn(DATABASE_1_DTO);
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
         when(credentialService.getUser(USER_1_ID))
                 .thenReturn(USER_1_DTO);
 
@@ -85,12 +85,12 @@ public class AccessEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_1_ID))
-                .thenReturn(DATABASE_1_DTO);
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
         when(credentialService.getUser(USER_4_ID))
                 .thenReturn(USER_4_DTO);
         doThrow(SQLException.class)
                 .when(accessService)
-                .create(DATABASE_1_DTO, USER_4_DTO, AccessTypeDto.READ);
+                .create(DATABASE_1_PRIVILEGED_DTO, USER_4_DTO, AccessTypeDto.READ);
 
         /* test */
         assertThrows(DatabaseUnavailableException.class, () -> {
@@ -121,7 +121,7 @@ public class AccessEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_1_ID))
-                .thenReturn(DATABASE_1_DTO);
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
         doThrow(UserNotFoundException.class)
                 .when(credentialService)
                 .getUser(USER_4_ID);
@@ -149,7 +149,7 @@ public class AccessEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_1_ID))
-                .thenReturn(DATABASE_1_DTO);
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
         when(credentialService.getUser(USER_1_ID))
                 .thenReturn(USER_1_DTO);
 
@@ -166,12 +166,12 @@ public class AccessEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_1_ID))
-                .thenReturn(DATABASE_1_DTO);
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
         when(credentialService.getUser(USER_1_ID))
                 .thenReturn(USER_1_DTO);
         doThrow(SQLException.class)
                 .when(accessService)
-                .update(DATABASE_1_DTO, USER_1_DTO, AccessTypeDto.READ);
+                .update(DATABASE_1_PRIVILEGED_DTO, USER_1_DTO, AccessTypeDto.READ);
 
         /* test */
         assertThrows(DatabaseUnavailableException.class, () -> {
@@ -186,7 +186,7 @@ public class AccessEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_1_ID))
-                .thenReturn(DATABASE_1_DTO);
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
         when(credentialService.getUser(USER_4_ID))
                 .thenReturn(USER_4_DTO);
 
@@ -229,7 +229,7 @@ public class AccessEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_1_ID))
-                .thenReturn(DATABASE_1_DTO);
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
         doThrow(UserNotFoundException.class)
                 .when(credentialService)
                 .getUser(USER_1_ID);
@@ -248,7 +248,7 @@ public class AccessEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_1_ID))
-                .thenReturn(DATABASE_1_DTO);
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
         when(credentialService.getUser(USER_1_ID))
                 .thenReturn(USER_1_DTO);
         doNothing()
@@ -268,7 +268,7 @@ public class AccessEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_1_ID))
-                .thenReturn(DATABASE_1_DTO);
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
         when(credentialService.getUser(USER_4_ID))
                 .thenReturn(USER_4_DTO);
 
@@ -311,7 +311,7 @@ public class AccessEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_1_ID))
-                .thenReturn(DATABASE_1_DTO);
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
         doThrow(UserNotFoundException.class)
                 .when(credentialService)
                 .getUser(USER_1_ID);
@@ -329,12 +329,12 @@ public class AccessEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_1_ID))
-                .thenReturn(DATABASE_1_DTO);
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
         when(credentialService.getUser(USER_1_ID))
                 .thenReturn(USER_1_DTO);
         doThrow(SQLException.class)
                 .when(accessService)
-                .delete(DATABASE_1_DTO, USER_1_DTO);
+                .delete(DATABASE_1_PRIVILEGED_DTO, USER_1_DTO);
 
         /* test */
         assertThrows(DatabaseUnavailableException.class, () -> {
diff --git a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/endpoint/DatabaseEndpointUnitTest.java b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/endpoint/DatabaseEndpointUnitTest.java
index 0c6f9d8521d1a1214e4ab1145e55fa8b3e9c3299..43f7b9353e0381a6bc001b1a563036e20e8daae1 100644
--- a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/endpoint/DatabaseEndpointUnitTest.java
+++ b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/endpoint/DatabaseEndpointUnitTest.java
@@ -65,13 +65,13 @@ public class DatabaseEndpointUnitTest extends AbstractUnitTest {
         when(credentialService.getContainer(CONTAINER_1_ID))
                 .thenReturn(CONTAINER_1_DTO);
         when(containerService.createDatabase(CONTAINER_1_DTO, DATABASE_1_CREATE_INTERNAL))
-                .thenReturn(DATABASE_1_DTO);
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
         doNothing()
                 .when(containerService)
                 .createQueryStore(CONTAINER_1_DTO, DATABASE_1_INTERNALNAME);
         doNothing()
                 .when(accessService)
-                .create(eq(DATABASE_1_DTO), any(UserDto.class), any(AccessTypeDto.class));
+                .create(eq(DATABASE_1_PRIVILEGED_DTO), any(UserDto.class), any(AccessTypeDto.class));
 
         /* test */
         final ResponseEntity<DatabaseDto> response = databaseEndpoint.create(DATABASE_1_CREATE_INTERNAL);
@@ -87,13 +87,13 @@ public class DatabaseEndpointUnitTest extends AbstractUnitTest {
         when(credentialService.getContainer(CONTAINER_1_ID))
                 .thenReturn(CONTAINER_1_DTO);
         when(containerService.createDatabase(CONTAINER_1_DTO, DATABASE_1_CREATE_INTERNAL))
-                .thenReturn(DATABASE_1_DTO);
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
         doNothing()
                 .when(containerService)
                 .createQueryStore(CONTAINER_1_DTO, DATABASE_1_INTERNALNAME);
         doNothing()
                 .when(accessService)
-                .create(eq(DATABASE_1_DTO), any(UserDto.class), any(AccessTypeDto.class));
+                .create(eq(DATABASE_1_PRIVILEGED_DTO), any(UserDto.class), any(AccessTypeDto.class));
 
         /* test */
         assertThrows(org.springframework.security.access.AccessDeniedException.class, () -> {
@@ -145,7 +145,7 @@ public class DatabaseEndpointUnitTest extends AbstractUnitTest {
                 .when(credentialService)
                 .getContainer(CONTAINER_1_ID);
         when(containerService.createDatabase(CONTAINER_1_DTO, DATABASE_1_CREATE_INTERNAL))
-                .thenReturn(DATABASE_1_DTO);
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
         doThrow(QueryStoreCreateException.class)
                 .when(containerService)
                 .createQueryStore(CONTAINER_1_DTO, DATABASE_1_INTERNALNAME);
@@ -163,7 +163,7 @@ public class DatabaseEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_1_ID))
-                .thenReturn(DATABASE_1_DTO);
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
 
         /* test */
         databaseEndpoint.update(DATABASE_1_ID, USER_1_UPDATE_PASSWORD_DTO);
@@ -176,10 +176,10 @@ public class DatabaseEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_1_ID))
-                .thenReturn(DATABASE_1_DTO);
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
         doThrow(SQLException.class)
                 .when(databaseService)
-                .update(DATABASE_1_DTO, USER_1_UPDATE_PASSWORD_DTO);
+                .update(DATABASE_1_PRIVILEGED_DTO, USER_1_UPDATE_PASSWORD_DTO);
 
         /* test */
         assertThrows(DatabaseUnavailableException.class, () -> {
@@ -193,7 +193,7 @@ public class DatabaseEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_1_ID))
-                .thenReturn(DATABASE_1_DTO);
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
 
         /* test */
         assertThrows(org.springframework.security.access.AccessDeniedException.class, () -> {
@@ -224,10 +224,10 @@ public class DatabaseEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_1_ID))
-                .thenReturn(DATABASE_1_DTO);
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
         doThrow(DatabaseMalformedException.class)
                 .when(databaseService)
-                .update(DATABASE_1_DTO, USER_1_UPDATE_PASSWORD_DTO);
+                .update(DATABASE_1_PRIVILEGED_DTO, USER_1_UPDATE_PASSWORD_DTO);
 
         /* test */
         assertThrows(DatabaseMalformedException.class, () -> {
diff --git a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/endpoint/SubsetEndpointUnitTest.java b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/endpoint/SubsetEndpointUnitTest.java
index 53393be4073d4804b65c4dde13b248612b59d143..8837ccb0d1c96f3dff61c0826fcabb956ecdc914 100644
--- a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/endpoint/SubsetEndpointUnitTest.java
+++ b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/endpoint/SubsetEndpointUnitTest.java
@@ -1,14 +1,14 @@
 package at.tuwien.endpoint;
 
-import at.tuwien.api.SortTypeDto;
+import at.tuwien.api.database.CreateViewDto;
 import at.tuwien.api.database.DatabaseDto;
 import at.tuwien.api.database.query.ExecuteStatementDto;
 import at.tuwien.api.database.query.QueryDto;
 import at.tuwien.api.database.query.QueryPersistDto;
 import at.tuwien.endpoints.SubsetEndpoint;
 import at.tuwien.exception.*;
-import at.tuwien.gateway.MetadataServiceGateway;
 import at.tuwien.service.CredentialService;
+import at.tuwien.service.DatabaseService;
 import at.tuwien.service.StorageService;
 import at.tuwien.service.SubsetService;
 import at.tuwien.test.AbstractUnitTest;
@@ -52,15 +52,15 @@ public class SubsetEndpointUnitTest extends AbstractUnitTest {
     @MockBean
     private SubsetService subsetService;
 
-    @MockBean
-    private MetadataServiceGateway metadataServiceGateway;
-
     @MockBean
     private HttpServletRequest httpServletRequest;
 
     @MockBean
     private StorageService storageService;
 
+    @MockBean
+    private DatabaseService databaseService;
+
     @MockBean
     private CredentialService credentialService;
 
@@ -75,12 +75,12 @@ public class SubsetEndpointUnitTest extends AbstractUnitTest {
             RemoteUnavailableException, SQLException, MetadataServiceException {
 
         /* mock */
-        when(subsetService.findAll(DATABASE_3_DTO, null))
+        when(subsetService.findAll(DATABASE_3_PRIVILEGED_DTO, null))
                 .thenReturn(List.of(QUERY_1_DTO, QUERY_2_DTO, QUERY_3_DTO, QUERY_4_DTO, QUERY_5_DTO, QUERY_6_DTO));
 
         /* test */
         assertThrows(NotAllowedException.class, () -> {
-            generic_list(DATABASE_3_ID, DATABASE_3_DTO, null);
+            generic_list(DATABASE_3_ID, DATABASE_3_PRIVILEGED_DTO, null);
         });
     }
 
@@ -91,11 +91,13 @@ public class SubsetEndpointUnitTest extends AbstractUnitTest {
             MetadataServiceException {
 
         /* mock */
-        when(subsetService.findAll(DATABASE_3_DTO, null))
+        when(credentialService.getAccess(DATABASE_3_ID, USER_3_ID))
+                .thenReturn(DATABASE_3_USER_1_READ_ACCESS_DTO);
+        when(subsetService.findAll(DATABASE_3_PRIVILEGED_DTO, null))
                 .thenReturn(List.of(QUERY_1_DTO, QUERY_2_DTO, QUERY_3_DTO, QUERY_4_DTO, QUERY_5_DTO, QUERY_6_DTO));
 
         /* test */
-        final List<QueryDto> response = generic_list(DATABASE_3_ID, DATABASE_3_DTO, USER_3_PRINCIPAL);
+        final List<QueryDto> response = generic_list(DATABASE_3_ID, DATABASE_3_PRIVILEGED_DTO, USER_3_PRINCIPAL);
         assertEquals(6, response.size());
     }
 
@@ -116,14 +118,14 @@ public class SubsetEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_3_ID))
-                .thenReturn(DATABASE_3_DTO);
+                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
         doThrow(SQLException.class)
                 .when(subsetService)
-                .findAll(DATABASE_3_DTO, null);
+                .findAll(DATABASE_3_PRIVILEGED_DTO, null);
 
         /* test */
         assertThrows(DatabaseUnavailableException.class, () -> {
-            generic_list(DATABASE_3_ID, DATABASE_3_DTO, USER_3_PRINCIPAL);
+            generic_list(DATABASE_3_ID, DATABASE_3_PRIVILEGED_DTO, USER_3_PRINCIPAL);
         });
     }
 
@@ -134,7 +136,7 @@ public class SubsetEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_1_ID))
-                .thenReturn(DATABASE_1_DTO);
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
 
         /* test */
         assertThrows(NotAllowedException.class, () -> {
@@ -149,8 +151,8 @@ public class SubsetEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_1_ID))
-                .thenReturn(DATABASE_1_DTO);
-        when(subsetService.findById(DATABASE_1_DTO, QUERY_1_ID))
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
+        when(subsetService.findById(DATABASE_1_PRIVILEGED_DTO, QUERY_1_ID))
                 .thenReturn(QUERY_1_DTO);
 
         /* test */
@@ -167,8 +169,8 @@ public class SubsetEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_3_ID))
-                .thenReturn(DATABASE_3_DTO);
-        when(subsetService.findById(DATABASE_3_DTO, QUERY_5_ID))
+                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
+        when(subsetService.findById(DATABASE_3_PRIVILEGED_DTO, QUERY_5_ID))
                 .thenReturn(QUERY_5_DTO);
 
         /* test */
@@ -182,8 +184,8 @@ public class SubsetEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_4_ID))
-                .thenReturn(DATABASE_4_DTO);
-        when(subsetService.findById(DATABASE_4_DTO, QUERY_7_ID))
+                .thenReturn(DATABASE_4_PRIVILEGED_DTO);
+        when(subsetService.findById(DATABASE_4_PRIVILEGED_DTO, QUERY_7_ID))
                 .thenReturn(QUERY_7_DTO);
 
         /* test */
@@ -202,13 +204,13 @@ public class SubsetEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_1_ID))
-                .thenReturn(DATABASE_1_DTO);
-        when(subsetService.findById(DATABASE_1_DTO, QUERY_1_ID))
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
+        when(subsetService.findById(DATABASE_1_PRIVILEGED_DTO, QUERY_1_ID))
                 .thenReturn(QUERY_5_DTO);
+        when(subsetService.getData(any(DatabaseDto.class), anyString(), any(Instant.class), eq(null), eq(null), eq(null), eq(null)))
+                .thenReturn(mock);
         when(storageService.transformDataset(any(Dataset.class)))
                 .thenReturn(EXPORT_RESOURCE_DTO);
-        when(subsetService.getData(any(DatabaseDto.class), anyString(), any(Instant.class), eq(0L), eq(10L), any(SortTypeDto.class), anyString()))
-                .thenReturn(mock);
 
         /* test */
         generic_findById(DATABASE_1_ID, QUERY_1_ID, "text/csv", null, USER_1_PRINCIPAL);
@@ -221,7 +223,7 @@ public class SubsetEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_3_ID))
-                .thenReturn(DATABASE_3_DTO);
+                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
 
         /* test */
         assertThrows(NotAllowedException.class, () -> {
@@ -238,10 +240,10 @@ public class SubsetEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_3_ID))
-                .thenReturn(DATABASE_3_DTO);
-        when(subsetService.findById(DATABASE_4_DTO, QUERY_5_ID))
+                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
+        when(subsetService.findById(DATABASE_4_PRIVILEGED_DTO, QUERY_5_ID))
                 .thenReturn(QUERY_5_DTO);
-        when(subsetService.getData(any(DatabaseDto.class), anyString(), any(Instant.class), eq(0L), eq(10L), any(SortTypeDto.class), anyString()))
+        when(subsetService.getData(any(DatabaseDto.class), anyString(), any(Instant.class), eq(0L), eq(10L), eq(null), eq(null)))
                 .thenReturn(mock);
         when(storageService.transformDataset(any(Dataset.class)))
                 .thenReturn(EXPORT_RESOURCE_DTO);
@@ -275,10 +277,10 @@ public class SubsetEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_3_ID))
-                .thenReturn(DATABASE_3_DTO);
+                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
         doThrow(SQLException.class)
                 .when(subsetService)
-                .findById(DATABASE_3_DTO, QUERY_5_ID);
+                .findById(DATABASE_3_PRIVILEGED_DTO, QUERY_5_ID);
 
         /* test */
         assertThrows(DatabaseUnavailableException.class, () -> {
@@ -286,29 +288,6 @@ public class SubsetEndpointUnitTest extends AbstractUnitTest {
         });
     }
 
-    @Test
-    @WithMockUser(username = USER_1_USERNAME)
-    public void findById_publicDataPrivateSchemaUnavailableExport_fails() throws DatabaseNotFoundException,
-            RemoteUnavailableException, MetadataServiceException, SQLException, QueryMalformedException,
-            UserNotFoundException, QueryNotFoundException, TableNotFoundException, StorageUnavailableException {
-
-        /* mock */
-        when(credentialService.getDatabase(DATABASE_3_ID))
-                .thenReturn(DATABASE_3_DTO);
-        when(subsetService.findById(DATABASE_3_DTO, QUERY_5_ID))
-                .thenReturn(QUERY_5_DTO);
-        when(storageService.transformDataset(any(Dataset.class)))
-                .thenReturn(EXPORT_RESOURCE_DTO);
-        doThrow(SQLException.class)
-                .when(subsetService)
-                .getData(any(DatabaseDto.class), anyString(), any(Instant.class), eq(0L), eq(10L), any(SortTypeDto.class), anyString());
-
-        /* test */
-        assertThrows(DatabaseUnavailableException.class, () -> {
-            generic_findById(DATABASE_3_ID, QUERY_5_ID, "text/csv", null, USER_1_PRINCIPAL);
-        });
-    }
-
     @Test
     @WithMockUser(username = USER_1_USERNAME, authorities = {"execute-query"})
     public void create_noAccess_succeeds() throws UserNotFoundException, QueryStoreInsertException,
@@ -323,11 +302,13 @@ public class SubsetEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_3_ID))
-                .thenReturn(DATABASE_3_DTO);
-        when(subsetService.getData(any(DatabaseDto.class), anyString(), any(Instant.class), eq(0L), eq(10L), any(SortTypeDto.class), anyString()))
+                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
+        when(subsetService.getData(any(DatabaseDto.class), anyString(), any(Instant.class), eq(0L), eq(10L), eq(null), eq(null)))
                 .thenReturn(mock);
-        when(subsetService.findById(eq(DATABASE_3_DTO), anyLong()))
+        when(subsetService.findById(eq(DATABASE_3_PRIVILEGED_DTO), anyLong()))
                 .thenReturn(QUERY_5_DTO);
+        when(databaseService.inspectView(any(DatabaseDto.class), anyString()))
+                .thenReturn(QUERY_5_VIEW_DTO);
         when(httpServletRequest.getMethod())
                 .thenReturn("POST");
 
@@ -367,11 +348,17 @@ public class SubsetEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_3_ID))
-                .thenReturn(DATABASE_3_DTO);
-        when(subsetService.findById(eq(DATABASE_3_DTO), anyLong()))
+                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
+        when(subsetService.create(any(DatabaseDto.class), eq(QUERY_5_STATEMENT), any(Instant.class), eq(USER_1_ID)))
+                .thenReturn(QUERY_5_ID);
+        when(subsetService.findById(any(DatabaseDto.class), eq(QUERY_5_ID)))
                 .thenReturn(QUERY_5_DTO);
-        when(subsetService.getData(any(DatabaseDto.class), anyString(), any(Instant.class), eq(0L), eq(10L), any(SortTypeDto.class), anyString()))
+        when(subsetService.getData(any(DatabaseDto.class), anyString(), any(Instant.class), eq(0L), eq(10L), eq(null), eq(null)))
                 .thenReturn(mock);
+        when(databaseService.createView(any(DatabaseDto.class), any(CreateViewDto.class)))
+                .thenReturn(QUERY_5_VIEW_DTO);
+        when(databaseService.inspectView(any(DatabaseDto.class), anyString()))
+                .thenReturn(QUERY_5_VIEW_DTO);
         when(httpServletRequest.getMethod())
                 .thenReturn("POST");
 
@@ -379,38 +366,6 @@ public class SubsetEndpointUnitTest extends AbstractUnitTest {
         subsetEndpoint.create(DATABASE_3_ID, request, USER_1_PRINCIPAL, httpServletRequest, null, null, null);
     }
 
-    @Test
-    @WithMockUser(username = USER_1_USERNAME, authorities = {"execute-query"})
-    public void create_unavailable_succeeds() throws DatabaseNotFoundException, RemoteUnavailableException,
-            SQLException, MetadataServiceException, QueryMalformedException, TableNotFoundException,
-            ViewMalformedException, UserNotFoundException, QueryNotFoundException, QueryStoreInsertException,
-            NotAllowedException {
-        final ExecuteStatementDto request = ExecuteStatementDto.builder()
-                .statement(QUERY_5_STATEMENT)
-                .build();
-
-        /* mock */
-        when(credentialService.getDatabase(DATABASE_3_ID))
-                .thenReturn(DATABASE_3_DTO);
-        doThrow(SQLException.class)
-                .when(subsetService)
-                .getData(any(DatabaseDto.class), anyString(), any(Instant.class), eq(0L), eq(10L), any(SortTypeDto.class), anyString());
-        when(subsetService.findById(eq(DATABASE_3_DTO), anyLong()))
-                .thenReturn(QUERY_5_DTO);
-        when(metadataServiceGateway.getAccess(DATABASE_3_ID, USER_1_ID))
-                .thenReturn(DATABASE_3_USER_1_READ_ACCESS_DTO);
-        doThrow(SQLException.class)
-                .when(subsetService)
-                .create(eq(DATABASE_3_DTO), eq(QUERY_5_STATEMENT), any(Instant.class), eq(USER_1_ID));
-        when(httpServletRequest.getMethod())
-                .thenReturn("POST");
-
-        /* test */
-        assertThrows(DatabaseUnavailableException.class, () -> {
-            subsetEndpoint.create(DATABASE_3_ID, request, USER_1_PRINCIPAL, httpServletRequest, null, null, null);
-        });
-    }
-
     @Test
     @WithMockUser(username = USER_1_USERNAME, authorities = {"execute-query"})
     public void create_databaseNotFound_fails() throws RemoteUnavailableException,
@@ -432,32 +387,6 @@ public class SubsetEndpointUnitTest extends AbstractUnitTest {
         });
     }
 
-    @Test
-    @WithMockUser(username = USER_4_USERNAME)
-    public void create_noRole_fails() throws DatabaseNotFoundException, RemoteUnavailableException,
-            MetadataServiceException, UserNotFoundException, QueryStoreInsertException, TableMalformedException,
-            NotAllowedException, SQLException, QueryNotFoundException, DatabaseUnavailableException,
-            StorageUnavailableException, QueryMalformedException, QueryNotSupportedException, PaginationException,
-            StorageNotFoundException, TableNotFoundException, ViewMalformedException, ViewNotFoundException {
-        final Dataset<Row> mock = sparkSession.emptyDataFrame();
-        final ExecuteStatementDto request = ExecuteStatementDto.builder()
-                .statement(QUERY_5_STATEMENT)
-                .build();
-
-        /* mock */
-        when(credentialService.getDatabase(DATABASE_3_ID))
-                .thenReturn(DATABASE_3_DTO);
-        when(subsetService.getData(any(DatabaseDto.class), anyString(), any(Instant.class), eq(0L), eq(10L), any(SortTypeDto.class), anyString()))
-                .thenReturn(mock);
-        when(subsetService.findById(eq(DATABASE_3_DTO), anyLong()))
-                .thenReturn(QUERY_5_DTO);
-        when(httpServletRequest.getMethod())
-                .thenReturn("POST");
-
-        /* test */
-        subsetEndpoint.create(DATABASE_3_ID, request, USER_4_PRINCIPAL, httpServletRequest, null, null, null);
-    }
-
     @Test
     @WithAnonymousUser
     public void create_publicDataPublicSchemaAnonymous_succeeds() throws DatabaseNotFoundException, RemoteUnavailableException,
@@ -472,11 +401,13 @@ public class SubsetEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_4_ID))
-                .thenReturn(DATABASE_4_DTO);
-        when(subsetService.findById(eq(DATABASE_4_DTO), anyLong()))
+                .thenReturn(DATABASE_4_PRIVILEGED_DTO);
+        when(subsetService.findById(eq(DATABASE_4_PRIVILEGED_DTO), anyLong()))
                 .thenReturn(QUERY_5_DTO);
-        when(subsetService.getData(any(DatabaseDto.class), anyString(), any(Instant.class), eq(0L), eq(10L), any(SortTypeDto.class), anyString()))
+        when(subsetService.getData(any(DatabaseDto.class), anyString(), any(Instant.class), eq(0L), eq(10L), eq(null), eq(null)))
                 .thenReturn(mock);
+        when(databaseService.inspectView(any(DatabaseDto.class), anyString()))
+                .thenReturn(QUERY_5_VIEW_DTO);
         when(httpServletRequest.getMethod())
                 .thenReturn("POST");
 
@@ -498,11 +429,13 @@ public class SubsetEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_1_ID))
-                .thenReturn(DATABASE_1_DTO);
-        when(subsetService.findById(eq(DATABASE_1_DTO), anyLong()))
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
+        when(subsetService.findById(eq(DATABASE_1_PRIVILEGED_DTO), anyLong()))
                 .thenReturn(QUERY_1_DTO);
-        when(subsetService.getData(any(DatabaseDto.class), anyString(), any(Instant.class), eq(0L), eq(10L), any(SortTypeDto.class), anyString()))
+        when(subsetService.getData(any(DatabaseDto.class), anyString(), any(Instant.class), eq(0L), eq(10L), eq(null), eq(null)))
                 .thenReturn(mock);
+        when(databaseService.inspectView(any(DatabaseDto.class), anyString()))
+                .thenReturn(QUERY_1_VIEW_DTO);
         when(httpServletRequest.getMethod())
                 .thenReturn("POST");
 
@@ -522,10 +455,10 @@ public class SubsetEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_2_ID))
-                .thenReturn(DATABASE_2_DTO);
-        when(subsetService.findById(eq(DATABASE_2_DTO), anyLong()))
+                .thenReturn(DATABASE_2_PRIVILEGED_DTO);
+        when(subsetService.findById(eq(DATABASE_2_PRIVILEGED_DTO), anyLong()))
                 .thenReturn(QUERY_2_DTO);
-        when(subsetService.getData(any(DatabaseDto.class), anyString(), any(Instant.class), eq(0L), eq(10L), any(SortTypeDto.class), anyString()))
+        when(subsetService.getData(any(DatabaseDto.class), anyString(), any(Instant.class), eq(0L), eq(10L), eq(null), eq(null)))
                 .thenReturn(mock);
         when(httpServletRequest.getMethod())
                 .thenReturn("POST");
@@ -540,18 +473,20 @@ public class SubsetEndpointUnitTest extends AbstractUnitTest {
     public void getData_succeeds() throws DatabaseNotFoundException, RemoteUnavailableException, UserNotFoundException,
             NotAllowedException, SQLException, QueryNotFoundException, TableMalformedException, QueryMalformedException,
             DatabaseUnavailableException, PaginationException, MetadataServiceException, TableNotFoundException,
-            ViewNotFoundException {
+            ViewNotFoundException, ViewMalformedException {
         final Dataset<Row> mock = sparkSession.emptyDataFrame();
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_3_ID))
-                .thenReturn(DATABASE_3_DTO);
-        when(subsetService.findById(DATABASE_3_DTO, QUERY_5_ID))
+                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
+        when(subsetService.findById(DATABASE_3_PRIVILEGED_DTO, QUERY_5_ID))
                 .thenReturn(QUERY_5_DTO);
-        when(subsetService.reExecuteCount(DATABASE_3_DTO, QUERY_5_DTO))
+        when(subsetService.reExecuteCount(DATABASE_3_PRIVILEGED_DTO, QUERY_5_DTO))
                 .thenReturn(QUERY_5_RESULT_NUMBER);
-        when(subsetService.getData(any(DatabaseDto.class), anyString(), any(Instant.class), eq(0L), eq(10L), any(SortTypeDto.class), anyString()))
+        when(subsetService.getData(any(DatabaseDto.class), anyString(), any(Instant.class), eq(0L), eq(10L), eq(null), eq(null)))
                 .thenReturn(mock);
+        when(databaseService.inspectView(any(DatabaseDto.class), anyString()))
+                .thenReturn(QUERY_5_VIEW_DTO);
         when(httpServletRequest.getMethod())
                 .thenReturn("GET");
 
@@ -565,14 +500,14 @@ public class SubsetEndpointUnitTest extends AbstractUnitTest {
     public void getData_head_succeeds() throws DatabaseNotFoundException, RemoteUnavailableException,
             UserNotFoundException, NotAllowedException, SQLException, QueryNotFoundException, TableMalformedException,
             QueryMalformedException, DatabaseUnavailableException, PaginationException, MetadataServiceException,
-            TableNotFoundException, ViewNotFoundException {
+            TableNotFoundException, ViewNotFoundException, ViewMalformedException {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_3_ID))
-                .thenReturn(DATABASE_3_DTO);
-        when(subsetService.findById(DATABASE_3_DTO, QUERY_5_ID))
+                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
+        when(subsetService.findById(DATABASE_3_PRIVILEGED_DTO, QUERY_5_ID))
                 .thenReturn(QUERY_5_DTO);
-        when(subsetService.reExecuteCount(DATABASE_3_DTO, QUERY_5_DTO))
+        when(subsetService.reExecuteCount(DATABASE_3_PRIVILEGED_DTO, QUERY_5_DTO))
                 .thenReturn(QUERY_5_RESULT_NUMBER);
         when(httpServletRequest.getMethod())
                 .thenReturn("HEAD");
@@ -590,18 +525,20 @@ public class SubsetEndpointUnitTest extends AbstractUnitTest {
     public void getData_private_succeeds() throws DatabaseNotFoundException, RemoteUnavailableException,
             UserNotFoundException, DatabaseUnavailableException, NotAllowedException, TableMalformedException,
             QueryMalformedException, QueryNotFoundException, PaginationException, SQLException,
-            MetadataServiceException, TableNotFoundException, ViewNotFoundException {
+            MetadataServiceException, TableNotFoundException, ViewNotFoundException, ViewMalformedException {
         final Dataset<Row> mock = sparkSession.emptyDataFrame();
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_1_ID))
-                .thenReturn(DATABASE_1_DTO);
-        when(subsetService.findById(DATABASE_1_DTO, QUERY_1_ID))
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
+        when(subsetService.findById(DATABASE_1_PRIVILEGED_DTO, QUERY_1_ID))
                 .thenReturn(QUERY_1_DTO);
-        when(subsetService.reExecuteCount(DATABASE_1_DTO, QUERY_1_DTO))
+        when(subsetService.reExecuteCount(DATABASE_1_PRIVILEGED_DTO, QUERY_1_DTO))
                 .thenReturn(QUERY_1_RESULT_NUMBER);
-        when(subsetService.getData(DATABASE_1_DTO, QUERY_1_STATEMENT, Instant.now(), 0L, 10L, null, null))
+        when(subsetService.getData(any(DatabaseDto.class), anyString(), any(Instant.class), eq(0L), eq(10L), eq(null), eq(null)))
                 .thenReturn(mock);
+        when(databaseService.inspectView(any(DatabaseDto.class), anyString()))
+                .thenReturn(QUERY_1_VIEW_DTO);
         when(httpServletRequest.getMethod())
                 .thenReturn("GET");
 
@@ -618,7 +555,7 @@ public class SubsetEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_1_ID))
-                .thenReturn(DATABASE_1_DTO);
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
 
         /* test */
         assertThrows(NotAllowedException.class, () -> {
@@ -633,7 +570,7 @@ public class SubsetEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_1_ID))
-                .thenReturn(DATABASE_1_DTO);
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
         doThrow(NotAllowedException.class)
                 .when(credentialService)
                 .getAccess(DATABASE_1_ID, USER_1_ID);
@@ -649,14 +586,14 @@ public class SubsetEndpointUnitTest extends AbstractUnitTest {
     public void getData_privateHead_succeeds() throws DatabaseNotFoundException, RemoteUnavailableException,
             UserNotFoundException, DatabaseUnavailableException, NotAllowedException, TableMalformedException,
             QueryMalformedException, QueryNotFoundException, PaginationException, SQLException,
-            MetadataServiceException, TableNotFoundException, ViewNotFoundException {
+            MetadataServiceException, TableNotFoundException, ViewNotFoundException, ViewMalformedException {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_1_ID))
-                .thenReturn(DATABASE_1_DTO);
-        when(subsetService.findById(DATABASE_1_DTO, QUERY_1_ID))
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
+        when(subsetService.findById(DATABASE_1_PRIVILEGED_DTO, QUERY_1_ID))
                 .thenReturn(QUERY_1_DTO);
-        when(subsetService.reExecuteCount(DATABASE_1_DTO, QUERY_1_DTO))
+        when(subsetService.reExecuteCount(DATABASE_1_PRIVILEGED_DTO, QUERY_1_DTO))
                 .thenReturn(QUERY_1_RESULT_NUMBER);
         when(httpServletRequest.getMethod())
                 .thenReturn("HEAD");
@@ -669,29 +606,6 @@ public class SubsetEndpointUnitTest extends AbstractUnitTest {
         assertEquals(QUERY_1_RESULT_NUMBER, Long.parseLong(response.getHeaders().get("X-Count").get(0)));
     }
 
-    @Test
-    @WithMockUser(username = USER_1_USERNAME)
-    public void getData_unavailable_fails() throws DatabaseNotFoundException, RemoteUnavailableException, SQLException,
-            UserNotFoundException, QueryNotFoundException, MetadataServiceException, QueryMalformedException,
-            TableNotFoundException {
-
-        /* mock */
-        when(credentialService.getDatabase(DATABASE_1_ID))
-                .thenReturn(DATABASE_1_DTO);
-        when(subsetService.findById(DATABASE_1_DTO, QUERY_1_ID))
-                .thenReturn(QUERY_1_DTO);
-        when(httpServletRequest.getMethod())
-                .thenReturn("GET");
-        doThrow(SQLException.class)
-                .when(subsetService)
-                .getData(DATABASE_1_DTO, QUERY_1_STATEMENT, Instant.now(), 0L, 10L, null, null);
-
-        /* test */
-        assertThrows(DatabaseUnavailableException.class, () -> {
-            subsetEndpoint.getData(DATABASE_1_ID, QUERY_1_ID, USER_1_PRINCIPAL, httpServletRequest, null, null, null);
-        });
-    }
-
     @Test
     @WithMockUser(username = USER_3_USERNAME, authorities = {"persist-query"})
     public void persist_succeeds() throws NotAllowedException, RemoteUnavailableException, DatabaseNotFoundException,
@@ -705,11 +619,11 @@ public class SubsetEndpointUnitTest extends AbstractUnitTest {
         when(credentialService.getAccess(DATABASE_3_ID, USER_3_ID))
                 .thenReturn(DATABASE_3_USER_3_READ_ACCESS_DTO);
         when(credentialService.getDatabase(DATABASE_3_ID))
-                .thenReturn(DATABASE_3_DTO);
+                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
         doNothing()
                 .when(subsetService)
-                .persist(DATABASE_3_DTO, QUERY_5_ID, true);
-        when(subsetService.findById(DATABASE_3_DTO, QUERY_5_ID))
+                .persist(DATABASE_3_PRIVILEGED_DTO, QUERY_5_ID, true);
+        when(subsetService.findById(DATABASE_3_PRIVILEGED_DTO, QUERY_5_ID))
                 .thenReturn(QUERY_5_DTO);
 
         /* test */
@@ -778,12 +692,12 @@ public class SubsetEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_3_ID))
-                .thenReturn(DATABASE_3_DTO);
+                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
         when(credentialService.getAccess(DATABASE_3_ID, USER_3_ID))
                 .thenReturn(DATABASE_3_USER_3_READ_ACCESS_DTO);
         doThrow(SQLException.class)
                 .when(subsetService)
-                .persist(DATABASE_3_DTO, QUERY_5_ID, true);
+                .persist(DATABASE_3_PRIVILEGED_DTO, QUERY_5_ID, true);
 
         /* test */
         assertThrows(DatabaseUnavailableException.class, () -> {
diff --git a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/endpoint/TableEndpointUnitTest.java b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/endpoint/TableEndpointUnitTest.java
index ecd745e3eeee7a85c2f54b2525a6f620606a077b..b37007a0108946429481c7fa229eb575bc6e98f0 100644
--- a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/endpoint/TableEndpointUnitTest.java
+++ b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/endpoint/TableEndpointUnitTest.java
@@ -1,6 +1,7 @@
 package at.tuwien.endpoint;
 
 import at.tuwien.api.database.DatabaseAccessDto;
+import at.tuwien.api.database.DatabaseDto;
 import at.tuwien.api.database.query.ImportDto;
 import at.tuwien.api.database.table.*;
 import at.tuwien.endpoints.TableEndpoint;
@@ -101,11 +102,11 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_1_ID))
-                .thenReturn(DATABASE_1_DTO);
-        when(databaseService.createTable(DATABASE_1_DTO, TABLE_4_CREATE_INTERNAL_DTO))
-                .thenReturn(TABLE_4_DTO);
-        when(databaseService.inspectTable(DATABASE_1_DTO, TABLE_4_INTERNALNAME))
-                .thenReturn(TABLE_4_DTO);
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
+        when(databaseService.createTable(DATABASE_1_PRIVILEGED_DTO, TABLE_4_CREATE_INTERNAL_DTO))
+                .thenReturn(TABLE_4_PRIVILEGED_DTO);
+        when(databaseService.inspectTable(DATABASE_1_PRIVILEGED_DTO, TABLE_4_INTERNALNAME))
+                .thenReturn(TABLE_4_PRIVILEGED_DTO);
 
         /* test */
         final ResponseEntity<TableDto> response = tableEndpoint.create(DATABASE_1_ID, TABLE_4_CREATE_INTERNAL_DTO);
@@ -145,10 +146,10 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_1_ID))
-                .thenReturn(DATABASE_1_DTO);
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
         doThrow(SQLException.class)
                 .when(databaseService)
-                .createTable(DATABASE_1_DTO, TABLE_4_CREATE_INTERNAL_DTO);
+                .createTable(DATABASE_1_PRIVILEGED_DTO, TABLE_4_CREATE_INTERNAL_DTO);
 
         /* test */
         assertThrows(DatabaseUnavailableException.class, () -> {
@@ -173,7 +174,7 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_3_ID, TABLE_8_ID))
-                .thenReturn(TABLE_8_DTO);
+                .thenReturn(TABLE_8_PRIVILEGED_DTO);
         when(tableService.getStatistics(any(TableDto.class)))
                 .thenReturn(TABLE_8_STATISTIC_DTO);
 
@@ -189,7 +190,7 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_3_ID, TABLE_8_ID))
-                .thenReturn(TABLE_8_DTO);
+                .thenReturn(TABLE_8_PRIVILEGED_DTO);
         doThrow(SQLException.class)
                 .when(tableService)
                 .getStatistics(any(TableDto.class));
@@ -223,10 +224,10 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_1_ID, TABLE_1_ID))
-                .thenReturn(TABLE_1_DTO);
+                .thenReturn(TABLE_1_PRIVILEGED_DTO);
         doNothing()
                 .when(tableService)
-                .delete(TABLE_1_DTO);
+                .delete(TABLE_1_PRIVILEGED_DTO);
 
         /* test */
         final ResponseEntity<Void> response = tableEndpoint.delete(DATABASE_1_ID, TABLE_1_ID);
@@ -266,10 +267,10 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_1_ID, TABLE_1_ID))
-                .thenReturn(TABLE_1_DTO);
+                .thenReturn(TABLE_1_PRIVILEGED_DTO);
         doThrow(SQLException.class)
                 .when(tableService)
-                .delete(TABLE_1_DTO);
+                .delete(TABLE_1_PRIVILEGED_DTO);
 
         /* test */
         assertThrows(DatabaseUnavailableException.class, () -> {
@@ -279,15 +280,17 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
     @Test
     @WithAnonymousUser
-    public void getData_succeeds() throws DatabaseUnavailableException, TableNotFoundException, QueryMalformedException,
+    public void getData_publicDataPrivateSchema_succeeds() throws DatabaseUnavailableException, TableNotFoundException, QueryMalformedException,
             RemoteUnavailableException, PaginationException, MetadataServiceException, NotAllowedException,
             DatabaseNotFoundException {
         final Dataset<Row> mock = sparkSession.emptyDataFrame();
 
         /* mock */
         when(credentialService.getTable(DATABASE_3_ID, TABLE_8_ID))
-                .thenReturn(TABLE_8_DTO);
-        when(subsetService.getData(eq(DATABASE_3_DTO), eq(TABLE_8_INTERNAL_NAME), any(Instant.class), eq(0L), eq(10L), eq(null), eq(null)))
+                .thenReturn(TABLE_8_PRIVILEGED_DTO);
+        when(credentialService.getDatabase(DATABASE_3_ID))
+                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
+        when(subsetService.getData(any(DatabaseDto.class), anyString(), any(Instant.class), eq(0L), eq(10L), eq(null), eq(null)))
                 .thenReturn(mock);
         when(httpServletRequest.getMethod())
                 .thenReturn("GET");
@@ -307,10 +310,10 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_3_ID, TABLE_8_ID))
-                .thenReturn(TABLE_8_DTO);
-        when(tableService.getCount(eq(TABLE_8_DTO), any(Instant.class)))
+                .thenReturn(TABLE_8_PRIVILEGED_DTO);
+        when(tableService.getCount(eq(TABLE_8_PRIVILEGED_DTO), any(Instant.class)))
                 .thenReturn(3L);
-        when(subsetService.getData(eq(DATABASE_3_DTO), eq(TABLE_8_INTERNAL_NAME), any(Instant.class), eq(0L), eq(10L), eq(null), eq(null)))
+        when(subsetService.getData(eq(DATABASE_3_PRIVILEGED_DTO), anyString(), any(Instant.class), eq(0L), eq(10L), eq(null), eq(null)))
                 .thenReturn(mock);
         when(httpServletRequest.getMethod())
                 .thenReturn("HEAD");
@@ -332,7 +335,7 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_1_ID, TABLE_1_ID))
-                .thenReturn(TABLE_1_DTO);
+                .thenReturn(TABLE_1_PRIVILEGED_DTO);
 
         /* test */
         assertThrows(NotAllowedException.class, () -> {
@@ -347,7 +350,7 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_1_ID, TABLE_1_ID))
-                .thenReturn(TABLE_1_DTO);
+                .thenReturn(TABLE_1_PRIVILEGED_DTO);
         doThrow(NotAllowedException.class)
                 .when(credentialService)
                 .getAccess(DATABASE_1_ID, USER_2_ID);
@@ -361,14 +364,16 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
     @Test
     @WithAnonymousUser
     public void getData_unavailable_fails() throws TableNotFoundException, RemoteUnavailableException,
-            MetadataServiceException, QueryMalformedException {
+            MetadataServiceException, QueryMalformedException, DatabaseNotFoundException {
 
         /* mock */
         when(credentialService.getTable(DATABASE_3_ID, TABLE_8_ID))
-                .thenReturn(TABLE_8_DTO);
+                .thenReturn(TABLE_8_PRIVILEGED_DTO);
+        when(credentialService.getDatabase(DATABASE_3_ID))
+                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
         doThrow(QueryMalformedException.class)
                 .when(subsetService)
-                .getData(eq(DATABASE_3_DTO), eq(TABLE_8_INTERNAL_NAME), any(Instant.class), eq(0L), eq(10L), eq(null), eq(null));
+                .getData(any(DatabaseDto.class), anyString(), any(Instant.class), eq(0L), eq(10L), eq(null), eq(null));
         when(httpServletRequest.getMethod())
                 .thenReturn("GET");
 
@@ -385,7 +390,7 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_1_ID, TABLE_1_ID))
-                .thenReturn(TABLE_1_DTO);
+                .thenReturn(TABLE_1_PRIVILEGED_DTO);
         doThrow(RemoteUnavailableException.class)
                 .when(credentialService)
                 .getAccess(DATABASE_1_ID, USER_2_ID);
@@ -406,10 +411,12 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_1_ID, TABLE_1_ID))
-                .thenReturn(TABLE_1_DTO);
+                .thenReturn(TABLE_1_PRIVILEGED_DTO);
+        when(credentialService.getDatabase(DATABASE_1_ID))
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
         when(credentialService.getAccess(DATABASE_1_ID, USER_2_ID))
                 .thenReturn(access);
-        when(subsetService.getData(eq(DATABASE_1_DTO), eq(TABLE_1_INTERNAL_NAME), any(Instant.class), eq(0L), eq(10L), eq(null), eq(null)))
+        when(subsetService.getData(any(DatabaseDto.class), anyString(), any(Instant.class), eq(0L), eq(10L), eq(null), eq(null)))
                 .thenReturn(mock);
         when(httpServletRequest.getMethod())
                 .thenReturn("GET");
@@ -449,12 +456,12 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_3_ID, TABLE_8_ID))
-                .thenReturn(TABLE_8_DTO);
+                .thenReturn(TABLE_8_PRIVILEGED_DTO);
         when(credentialService.getAccess(DATABASE_3_ID, USER_1_ID))
                 .thenReturn(DATABASE_3_USER_1_WRITE_OWN_ACCESS_DTO);
         doNothing()
                 .when(tableService)
-                .createTuple(TABLE_8_DTO, request);
+                .createTuple(TABLE_8_PRIVILEGED_DTO, request);
         doNothing()
                 .when(metadataServiceGateway)
                 .updateTableStatistics(DATABASE_3_ID, TABLE_8_ID, TOKEN_ACCESS_TOKEN);
@@ -515,7 +522,7 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_3_ID, TABLE_8_ID))
-                .thenReturn(TABLE_8_DTO);
+                .thenReturn(TABLE_8_PRIVILEGED_DTO);
         when(credentialService.getAccess(DATABASE_3_ID, USER_3_ID))
                 .thenReturn(DATABASE_3_USER_3_READ_ACCESS_DTO);
 
@@ -539,12 +546,12 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_3_ID, TABLE_8_ID))
-                .thenReturn(TABLE_8_DTO);
+                .thenReturn(TABLE_8_PRIVILEGED_DTO);
         when(credentialService.getAccess(DATABASE_3_ID, USER_1_ID))
                 .thenReturn(DATABASE_3_USER_1_WRITE_OWN_ACCESS_DTO);
         doThrow(SQLException.class)
                 .when(tableService)
-                .createTuple(TABLE_8_DTO, request);
+                .createTuple(TABLE_8_PRIVILEGED_DTO, request);
 
         /* test */
         assertThrows(DatabaseUnavailableException.class, () -> {
@@ -566,7 +573,7 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_3_ID, TABLE_8_ID))
-                .thenReturn(TABLE_8_DTO);
+                .thenReturn(TABLE_8_PRIVILEGED_DTO);
         when(credentialService.getAccess(DATABASE_3_ID, USER_1_ID))
                 .thenReturn(DATABASE_3_USER_1_WRITE_OWN_ACCESS_DTO);
 
@@ -587,7 +594,7 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_3_ID, TABLE_8_ID))
-                .thenReturn(TABLE_8_DTO);
+                .thenReturn(TABLE_8_PRIVILEGED_DTO);
         when(credentialService.getAccess(DATABASE_3_ID, USER_3_ID))
                 .thenReturn(DATABASE_3_USER_3_WRITE_OWN_ACCESS_DTO);
 
@@ -611,7 +618,7 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_3_ID, TABLE_8_ID))
-                .thenReturn(TABLE_8_DTO);
+                .thenReturn(TABLE_8_PRIVILEGED_DTO);
         when(credentialService.getAccess(DATABASE_3_ID, USER_3_ID))
                 .thenReturn(DATABASE_3_USER_3_WRITE_ALL_ACCESS_DTO);
 
@@ -636,12 +643,12 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_3_ID, TABLE_8_ID))
-                .thenReturn(TABLE_8_DTO);
+                .thenReturn(TABLE_8_PRIVILEGED_DTO);
         when(credentialService.getAccess(DATABASE_3_ID, USER_1_ID))
                 .thenReturn(DATABASE_3_USER_1_WRITE_OWN_ACCESS_DTO);
         doNothing()
                 .when(tableService)
-                .updateTuple(TABLE_8_DTO, request);
+                .updateTuple(TABLE_8_PRIVILEGED_DTO, request);
         doNothing()
                 .when(metadataServiceGateway)
                 .updateTableStatistics(DATABASE_3_ID, TABLE_8_ID, TOKEN_ACCESS_TOKEN);
@@ -711,7 +718,7 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_3_ID, TABLE_8_ID))
-                .thenReturn(TABLE_8_DTO);
+                .thenReturn(TABLE_8_PRIVILEGED_DTO);
         when(credentialService.getAccess(DATABASE_3_ID, USER_3_ID))
                 .thenReturn(DATABASE_3_USER_3_READ_ACCESS_DTO);
 
@@ -737,12 +744,12 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_3_ID, TABLE_8_ID))
-                .thenReturn(TABLE_8_DTO);
+                .thenReturn(TABLE_8_PRIVILEGED_DTO);
         when(credentialService.getAccess(DATABASE_3_ID, USER_3_ID))
                 .thenReturn(DATABASE_3_USER_3_WRITE_ALL_ACCESS_DTO);
         doThrow(SQLException.class)
                 .when(tableService)
-                .updateTuple(TABLE_8_DTO, request);
+                .updateTuple(TABLE_8_PRIVILEGED_DTO, request);
 
         /* test */
         assertThrows(DatabaseUnavailableException.class, () -> {
@@ -767,12 +774,12 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_3_ID, TABLE_8_ID))
-                .thenReturn(TABLE_8_DTO);
+                .thenReturn(TABLE_8_PRIVILEGED_DTO);
         when(credentialService.getAccess(DATABASE_3_ID, USER_1_ID))
                 .thenReturn(DATABASE_3_USER_1_WRITE_OWN_ACCESS_DTO);
         doNothing()
                 .when(tableService)
-                .updateTuple(TABLE_8_DTO, request);
+                .updateTuple(TABLE_8_PRIVILEGED_DTO, request);
         doNothing()
                 .when(metadataServiceGateway)
                 .updateTableStatistics(DATABASE_3_ID, TABLE_8_ID, TOKEN_ACCESS_TOKEN);
@@ -798,7 +805,7 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_3_ID, TABLE_8_ID))
-                .thenReturn(TABLE_8_DTO);
+                .thenReturn(TABLE_8_PRIVILEGED_DTO);
         when(credentialService.getAccess(DATABASE_3_ID, USER_3_ID))
                 .thenReturn(DATABASE_3_USER_3_WRITE_OWN_ACCESS_DTO);
 
@@ -825,12 +832,12 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_3_ID, TABLE_8_ID))
-                .thenReturn(TABLE_8_DTO);
+                .thenReturn(TABLE_8_PRIVILEGED_DTO);
         when(credentialService.getAccess(DATABASE_3_ID, USER_3_ID))
                 .thenReturn(DATABASE_3_USER_3_WRITE_ALL_ACCESS_DTO);
         doNothing()
                 .when(tableService)
-                .updateTuple(TABLE_8_DTO, request);
+                .updateTuple(TABLE_8_PRIVILEGED_DTO, request);
         doNothing()
                 .when(metadataServiceGateway)
                 .updateTableStatistics(DATABASE_3_ID, TABLE_8_ID, TOKEN_ACCESS_TOKEN);
@@ -853,12 +860,12 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_3_ID, TABLE_8_ID))
-                .thenReturn(TABLE_8_DTO);
+                .thenReturn(TABLE_8_PRIVILEGED_DTO);
         when(credentialService.getAccess(DATABASE_3_ID, USER_1_ID))
                 .thenReturn(DATABASE_3_USER_1_WRITE_OWN_ACCESS_DTO);
         doNothing()
                 .when(tableService)
-                .deleteTuple(TABLE_8_DTO, request);
+                .deleteTuple(TABLE_8_PRIVILEGED_DTO, request);
         doNothing()
                 .when(metadataServiceGateway)
                 .updateTableStatistics(DATABASE_3_ID, TABLE_8_ID, TOKEN_ACCESS_TOKEN);
@@ -916,7 +923,7 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_3_ID, TABLE_8_ID))
-                .thenReturn(TABLE_8_DTO);
+                .thenReturn(TABLE_8_PRIVILEGED_DTO);
         when(credentialService.getAccess(DATABASE_3_ID, USER_3_ID))
                 .thenReturn(DATABASE_3_USER_3_READ_ACCESS_DTO);
 
@@ -938,12 +945,12 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_3_ID, TABLE_8_ID))
-                .thenReturn(TABLE_8_DTO);
+                .thenReturn(TABLE_8_PRIVILEGED_DTO);
         when(credentialService.getAccess(DATABASE_3_ID, USER_1_ID))
                 .thenReturn(DATABASE_3_USER_3_WRITE_OWN_ACCESS_DTO);
         doThrow(SQLException.class)
                 .when(tableService)
-                .deleteTuple(TABLE_8_DTO, request);
+                .deleteTuple(TABLE_8_PRIVILEGED_DTO, request);
 
         /* test */
         assertThrows(DatabaseUnavailableException.class, () -> {
@@ -964,12 +971,12 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_3_ID, TABLE_8_ID))
-                .thenReturn(TABLE_8_DTO);
+                .thenReturn(TABLE_8_PRIVILEGED_DTO);
         when(credentialService.getAccess(DATABASE_3_ID, USER_1_ID))
                 .thenReturn(DATABASE_3_USER_3_WRITE_OWN_ACCESS_DTO);
         doNothing()
                 .when(tableService)
-                .deleteTuple(TABLE_8_DTO, request);
+                .deleteTuple(TABLE_8_PRIVILEGED_DTO, request);
         doNothing()
                 .when(metadataServiceGateway)
                 .updateTableStatistics(DATABASE_3_ID, TABLE_8_ID, TOKEN_ACCESS_TOKEN);
@@ -991,7 +998,7 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_3_ID, TABLE_8_ID))
-                .thenReturn(TABLE_8_DTO);
+                .thenReturn(TABLE_8_PRIVILEGED_DTO);
         when(credentialService.getAccess(DATABASE_3_ID, USER_3_ID))
                 .thenReturn(DATABASE_3_USER_3_WRITE_OWN_ACCESS_DTO);
 
@@ -1014,12 +1021,12 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_3_ID, TABLE_8_ID))
-                .thenReturn(TABLE_8_DTO);
+                .thenReturn(TABLE_8_PRIVILEGED_DTO);
         when(credentialService.getAccess(DATABASE_3_ID, USER_3_ID))
                 .thenReturn(DATABASE_3_USER_3_WRITE_ALL_ACCESS_DTO);
         doNothing()
                 .when(tableService)
-                .deleteTuple(TABLE_8_DTO, request);
+                .deleteTuple(TABLE_8_PRIVILEGED_DTO, request);
         doNothing()
                 .when(metadataServiceGateway)
                 .updateTableStatistics(DATABASE_3_ID, TABLE_8_ID, TOKEN_ACCESS_TOKEN);
@@ -1036,8 +1043,8 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_3_ID, TABLE_8_ID))
-                .thenReturn(TABLE_8_DTO);
-        when(tableService.history(TABLE_8_DTO, null))
+                .thenReturn(TABLE_8_PRIVILEGED_DTO);
+        when(tableService.history(TABLE_8_PRIVILEGED_DTO, null))
                 .thenReturn(List.of());
 
         /* test */
@@ -1052,7 +1059,7 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_1_ID, TABLE_1_ID))
-                .thenReturn(TABLE_1_DTO);
+                .thenReturn(TABLE_1_PRIVILEGED_DTO);
 
         /* test */
         assertThrows(NotAllowedException.class, () -> {
@@ -1078,7 +1085,7 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_1_ID, TABLE_1_ID))
-                .thenReturn(TABLE_1_DTO);
+                .thenReturn(TABLE_1_PRIVILEGED_DTO);
         doThrow(NotAllowedException.class)
                 .when(credentialService)
                 .getAccess(DATABASE_1_ID, USER_4_ID);
@@ -1096,10 +1103,10 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_1_ID, TABLE_1_ID))
-                .thenReturn(TABLE_1_DTO);
+                .thenReturn(TABLE_1_PRIVILEGED_DTO);
         when(credentialService.getAccess(DATABASE_1_ID, USER_2_ID))
                 .thenReturn(DATABASE_1_USER_2_READ_ACCESS_DTO);
-        when(tableService.history(TABLE_1_DTO, 10L))
+        when(tableService.history(TABLE_1_PRIVILEGED_DTO, 10L))
                 .thenReturn(List.of());
 
         /* test */
@@ -1114,10 +1121,10 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_3_ID, TABLE_8_ID))
-                .thenReturn(TABLE_8_DTO);
+                .thenReturn(TABLE_8_PRIVILEGED_DTO);
         doThrow(SQLException.class)
                 .when(tableService)
-                .history(TABLE_8_DTO, 100L);
+                .history(TABLE_8_PRIVILEGED_DTO, 100L);
 
         /* test */
         assertThrows(DatabaseUnavailableException.class, () -> {
@@ -1143,14 +1150,16 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
     @Test
     @WithAnonymousUser
-    public void exportData_succeeds() throws TableNotFoundException, NotAllowedException, StorageUnavailableException,
+    public void exportData_publicDataPrivateSchema_succeeds() throws TableNotFoundException, NotAllowedException, StorageUnavailableException,
             QueryMalformedException, RemoteUnavailableException, MetadataServiceException, DatabaseNotFoundException {
         final Dataset<Row> mock = sparkSession.emptyDataFrame();
 
         /* mock */
         when(credentialService.getTable(DATABASE_3_ID, TABLE_8_ID))
-                .thenReturn(TABLE_8_DTO);
-        when(subsetService.getData(eq(DATABASE_3_DTO), eq(TABLE_8_INTERNAL_NAME), any(Instant.class), eq(0L), eq(10L), eq(null), eq(null)))
+                .thenReturn(TABLE_8_PRIVILEGED_DTO);
+        when(credentialService.getDatabase(DATABASE_3_ID))
+                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
+        when(subsetService.getData(any(DatabaseDto.class), anyString(), any(Instant.class), eq(null), eq(null), eq(null), eq(null)))
                 .thenReturn(mock);
 
         /* test */
@@ -1161,17 +1170,19 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
     @ParameterizedTest
     @WithMockUser(username = USER_2_USERNAME)
     @MethodSource("anyAccess_parameters")
-    public void exportData_private_succeeds(String name, DatabaseAccessDto access) throws TableNotFoundException,
-            NotAllowedException, StorageUnavailableException, QueryMalformedException, RemoteUnavailableException,
-            MetadataServiceException, DatabaseNotFoundException {
+    public void exportData_privateDataPrivateSchema_succeeds(String name, DatabaseAccessDto access)
+            throws TableNotFoundException, NotAllowedException, StorageUnavailableException, QueryMalformedException,
+            RemoteUnavailableException, MetadataServiceException, DatabaseNotFoundException {
         final Dataset<Row> mock = sparkSession.emptyDataFrame();
 
         /* mock */
         when(credentialService.getTable(DATABASE_1_ID, TABLE_1_ID))
-                .thenReturn(TABLE_1_DTO);
+                .thenReturn(TABLE_1_PRIVILEGED_DTO);
         when(credentialService.getAccess(DATABASE_1_ID, USER_2_ID))
                 .thenReturn(access);
-        when(subsetService.getData(eq(DATABASE_1_DTO), eq(TABLE_1_INTERNAL_NAME), any(Instant.class), eq(0L), eq(10L), eq(null), eq(null)))
+        when(credentialService.getDatabase(DATABASE_1_ID))
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
+        when(subsetService.getData(any(DatabaseDto.class), anyString(), any(Instant.class), eq(null), eq(null), eq(null), eq(null)))
                 .thenReturn(mock);
 
         /* test */
@@ -1186,7 +1197,7 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_1_ID, TABLE_1_ID))
-                .thenReturn(TABLE_1_DTO);
+                .thenReturn(TABLE_1_PRIVILEGED_DTO);
         doThrow(NotAllowedException.class)
                 .when(credentialService)
                 .getAccess(DATABASE_1_ID, USER_4_ID);
@@ -1205,9 +1216,9 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_3_ID))
-                .thenReturn(DATABASE_3_DTO);
-        when(databaseService.exploreTables(DATABASE_3_DTO))
-                .thenReturn(List.of(TABLE_8_DTO));
+                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
+        when(databaseService.exploreTables(DATABASE_3_PRIVILEGED_DTO))
+                .thenReturn(List.of(TABLE_8_PRIVILEGED_DTO));
 
         /* test */
         final ResponseEntity<List<TableDto>> response = tableEndpoint.getSchema(DATABASE_3_ID);
@@ -1241,10 +1252,10 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_3_ID))
-                .thenReturn(DATABASE_3_DTO);
+                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
         doThrow(SQLException.class)
                 .when(databaseService)
-                .exploreTables(DATABASE_3_DTO);
+                .exploreTables(DATABASE_3_PRIVILEGED_DTO);
 
         /* test */
         assertThrows(DatabaseUnavailableException.class, () -> {
@@ -1264,12 +1275,12 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_3_ID, TABLE_8_ID))
-                .thenReturn(TABLE_8_DTO);
+                .thenReturn(TABLE_8_PRIVILEGED_DTO);
         when(credentialService.getAccess(DATABASE_3_ID, USER_1_ID))
                 .thenReturn(DATABASE_3_USER_1_WRITE_OWN_ACCESS_DTO);
         doNothing()
                 .when(tableService)
-                .importDataset(TABLE_8_DTO, request);
+                .importDataset(TABLE_8_PRIVILEGED_DTO, request);
         doNothing()
                 .when(metadataServiceGateway)
                 .updateTableStatistics(DATABASE_3_ID, TABLE_8_ID, TOKEN_ACCESS_TOKEN);
@@ -1328,7 +1339,7 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_3_ID, TABLE_8_ID))
-                .thenReturn(TABLE_8_DTO);
+                .thenReturn(TABLE_8_PRIVILEGED_DTO);
         when(credentialService.getAccess(DATABASE_3_ID, USER_3_ID))
                 .thenReturn(DATABASE_3_USER_3_WRITE_ALL_ACCESS_DTO);
         doThrow(SQLException.class)
@@ -1354,7 +1365,7 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_3_ID, TABLE_8_ID))
-                .thenReturn(TABLE_8_DTO);
+                .thenReturn(TABLE_8_PRIVILEGED_DTO);
         when(credentialService.getAccess(DATABASE_3_ID, USER_3_ID))
                 .thenReturn(DATABASE_3_USER_3_WRITE_OWN_ACCESS_DTO);
         doThrow(SQLException.class)
@@ -1379,7 +1390,7 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_3_ID, TABLE_8_ID))
-                .thenReturn(TABLE_8_DTO);
+                .thenReturn(TABLE_8_PRIVILEGED_DTO);
         when(credentialService.getAccess(DATABASE_3_ID, USER_3_ID))
                 .thenReturn(DATABASE_3_USER_3_READ_ACCESS_DTO);
 
@@ -1402,7 +1413,7 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_3_ID, TABLE_8_ID))
-                .thenReturn(TABLE_8_DTO);
+                .thenReturn(TABLE_8_PRIVILEGED_DTO);
         when(credentialService.getAccess(DATABASE_3_ID, USER_1_ID))
                 .thenReturn(DATABASE_3_USER_1_WRITE_OWN_ACCESS_DTO);
 
@@ -1422,7 +1433,7 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_3_ID, TABLE_8_ID))
-                .thenReturn(TABLE_8_DTO);
+                .thenReturn(TABLE_8_PRIVILEGED_DTO);
         when(credentialService.getAccess(DATABASE_3_ID, USER_3_ID))
                 .thenReturn(DATABASE_3_USER_3_WRITE_OWN_ACCESS_DTO);
 
@@ -1445,7 +1456,7 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_3_ID, TABLE_8_ID))
-                .thenReturn(TABLE_8_DTO);
+                .thenReturn(TABLE_8_PRIVILEGED_DTO);
         when(credentialService.getAccess(DATABASE_3_ID, USER_1_ID))
                 .thenReturn(DATABASE_3_USER_3_WRITE_ALL_ACCESS_DTO);
 
@@ -1466,7 +1477,7 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_1_ID, TABLE_1_ID))
-                .thenReturn(TABLE_1_DTO);
+                .thenReturn(TABLE_1_PRIVILEGED_DTO);
         when(credentialService.getAccess(DATABASE_1_ID, USER_2_ID))
                 .thenReturn(DATABASE_1_USER_2_WRITE_ALL_ACCESS_DTO);
 
@@ -1487,7 +1498,7 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_1_ID, TABLE_2_ID))
-                .thenReturn(TABLE_2_DTO);
+                .thenReturn(TABLE_2_PRIVILEGED_DTO);
         when(credentialService.getAccess(DATABASE_1_ID, USER_2_ID))
                 .thenReturn(DATABASE_1_USER_2_WRITE_OWN_ACCESS_DTO);
 
@@ -1507,7 +1518,7 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_1_ID, TABLE_1_ID))
-                .thenReturn(TABLE_1_DTO);
+                .thenReturn(TABLE_1_PRIVILEGED_DTO);
         when(credentialService.getAccess(DATABASE_1_ID, USER_2_ID))
                 .thenReturn(DATABASE_1_USER_2_WRITE_OWN_ACCESS_DTO);
 
@@ -1529,7 +1540,7 @@ public class TableEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getTable(DATABASE_1_ID, TABLE_2_ID))
-                .thenReturn(TABLE_2_DTO);
+                .thenReturn(TABLE_2_PRIVILEGED_DTO);
         when(credentialService.getAccess(DATABASE_1_ID, USER_2_ID))
                 .thenReturn(DATABASE_1_USER_2_READ_ACCESS_DTO);
 
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 c69c8d338e854d89892db62de126f465430d1fa3..5dce4988561b2bf653c77358701ccfba674d6269 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
@@ -1,5 +1,6 @@
 package at.tuwien.endpoint;
 
+import at.tuwien.api.database.DatabaseDto;
 import at.tuwien.api.database.ViewDto;
 import at.tuwien.endpoints.ViewEndpoint;
 import at.tuwien.exception.*;
@@ -71,9 +72,9 @@ public class ViewEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_1_ID))
-                .thenReturn(DATABASE_1_DTO);
-        when(databaseService.createView(DATABASE_1_DTO, VIEW_1_CREATE_DTO))
-                .thenReturn(VIEW_1_DTO);
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
+        when(databaseService.createView(DATABASE_1_PRIVILEGED_DTO, VIEW_1_CREATE_DTO))
+                .thenReturn(VIEW_1_PRIVILEGED_DTO);
 
         /* test */
         final ResponseEntity<ViewDto> response = viewEndpoint.create(DATABASE_1_ID, VIEW_1_CREATE_DTO);
@@ -87,10 +88,10 @@ public class ViewEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_1_ID))
-                .thenReturn(DATABASE_1_DTO);
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
         doThrow(SQLException.class)
                 .when(databaseService)
-                .createView(DATABASE_1_DTO, VIEW_1_CREATE_DTO);
+                .createView(DATABASE_1_PRIVILEGED_DTO, VIEW_1_CREATE_DTO);
 
         /* test */
         assertThrows(DatabaseUnavailableException.class, () -> {
@@ -105,9 +106,9 @@ public class ViewEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_1_ID))
-                .thenReturn(DATABASE_1_DTO);
-        when(databaseService.createView(DATABASE_1_DTO, VIEW_1_CREATE_DTO))
-                .thenReturn(VIEW_1_DTO);
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
+        when(databaseService.createView(DATABASE_1_PRIVILEGED_DTO, VIEW_1_CREATE_DTO))
+                .thenReturn(VIEW_1_PRIVILEGED_DTO);
 
         /* test */
         assertThrows(org.springframework.security.access.AccessDeniedException.class, () -> {
@@ -138,8 +139,8 @@ public class ViewEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_1_ID))
-                .thenReturn(DATABASE_1_DTO);
-        when(databaseService.exploreViews(DATABASE_1_DTO))
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
+        when(databaseService.exploreViews(DATABASE_1_PRIVILEGED_DTO))
                 .thenReturn(List.of(VIEW_1_DTO, VIEW_2_DTO, VIEW_3_DTO));
 
         /* test */
@@ -180,10 +181,10 @@ public class ViewEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_1_ID))
-                .thenReturn(DATABASE_1_DTO);
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
         doThrow(SQLException.class)
                 .when(databaseService)
-                .exploreViews(DATABASE_1_DTO);
+                .exploreViews(DATABASE_1_PRIVILEGED_DTO);
 
         /* test */
         assertThrows(DatabaseUnavailableException.class, () -> {
@@ -208,10 +209,10 @@ public class ViewEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getView(DATABASE_1_ID, VIEW_1_ID))
-                .thenReturn(VIEW_1_DTO);
+                .thenReturn(VIEW_1_PRIVILEGED_DTO);
         doNothing()
                 .when(viewService)
-                .delete(VIEW_1_DTO);
+                .delete(VIEW_1_PRIVILEGED_DTO);
 
         /* test */
         final ResponseEntity<Void> response = viewEndpoint.delete(DATABASE_1_ID, VIEW_1_ID);
@@ -225,10 +226,10 @@ public class ViewEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getView(DATABASE_1_ID, VIEW_1_ID))
-                .thenReturn(VIEW_1_DTO);
+                .thenReturn(VIEW_1_PRIVILEGED_DTO);
         doThrow(SQLException.class)
                 .when(viewService)
-                .delete(VIEW_1_DTO);
+                .delete(VIEW_1_PRIVILEGED_DTO);
 
         /* test */
         assertThrows(DatabaseUnavailableException.class, () -> {
@@ -243,10 +244,10 @@ public class ViewEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getDatabase(DATABASE_1_ID))
-                .thenReturn(DATABASE_1_DTO);
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
         doNothing()
                 .when(viewService)
-                .delete(VIEW_1_DTO);
+                .delete(VIEW_1_PRIVILEGED_DTO);
 
         /* test */
         assertThrows(org.springframework.security.access.AccessDeniedException.class, () -> {
@@ -272,17 +273,19 @@ public class ViewEndpointUnitTest extends AbstractUnitTest {
 
     @Test
     @WithMockUser(username = USER_1_USERNAME, authorities = {"view-database-view-data"})
-    public void getData_private_succeeds() throws RemoteUnavailableException, ViewNotFoundException,
+    public void getData_privateDataPrivateSchema_succeeds() throws RemoteUnavailableException, ViewNotFoundException,
             SQLException, DatabaseUnavailableException, QueryMalformedException, PaginationException,
             NotAllowedException, MetadataServiceException, TableNotFoundException, DatabaseNotFoundException {
         final Dataset<Row> mock = sparkSession.emptyDataFrame();
 
         /* mock */
         when(credentialService.getView(DATABASE_1_ID, VIEW_1_ID))
-                .thenReturn(VIEW_1_DTO);
+                .thenReturn(VIEW_1_PRIVILEGED_DTO);
+        when(credentialService.getDatabase(DATABASE_1_ID))
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
         when(credentialService.getAccess(DATABASE_1_ID, USER_1_ID))
                 .thenReturn(DATABASE_1_USER_1_READ_ACCESS_DTO);
-        when(subsetService.getData(eq(DATABASE_1_DTO), eq(VIEW_1_INTERNAL_NAME), any(Instant.class), eq(0L), eq(10L), eq(null), eq(null)))
+        when(subsetService.getData(any(DatabaseDto.class), anyString(), any(Instant.class), eq(0L), eq(10L), eq(null), eq(null)))
                 .thenReturn(mock);
         when(httpServletRequest.getMethod())
                 .thenReturn("GET");
@@ -301,12 +304,12 @@ public class ViewEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getView(DATABASE_1_ID, VIEW_3_ID))
-                .thenReturn(VIEW_3_DTO);
+                .thenReturn(VIEW_3_PRIVILEGED_DTO);
         when(credentialService.getAccess(DATABASE_1_ID, USER_1_ID))
                 .thenReturn(DATABASE_1_USER_1_READ_ACCESS_DTO);
         when(httpServletRequest.getMethod())
                 .thenReturn("HEAD");
-        when(viewService.count(eq(VIEW_3_DTO), any(Instant.class)))
+        when(viewService.count(eq(VIEW_3_PRIVILEGED_DTO), any(Instant.class)))
                 .thenReturn(VIEW_3_DATA_COUNT);
 
         /* test */
@@ -328,7 +331,7 @@ public class ViewEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getView(DATABASE_1_ID, VIEW_3_ID))
-                .thenReturn(VIEW_3_DTO);
+                .thenReturn(VIEW_3_PRIVILEGED_DTO);
         when(httpServletRequest.getMethod())
                 .thenReturn("GET");
         doThrow(NotAllowedException.class)
@@ -364,7 +367,7 @@ public class ViewEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getView(DATABASE_1_ID, VIEW_3_ID))
-                .thenReturn(VIEW_3_DTO);
+                .thenReturn(VIEW_3_PRIVILEGED_DTO);
         doThrow(NotAllowedException.class)
                 .when(credentialService)
                 .getAccess(DATABASE_1_ID, USER_3_ID);
@@ -382,7 +385,7 @@ public class ViewEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getView(DATABASE_1_ID, VIEW_3_ID))
-                .thenReturn(VIEW_3_DTO);
+                .thenReturn(VIEW_3_PRIVILEGED_DTO);
         doThrow(NotAllowedException.class)
                 .when(credentialService)
                 .getAccess(DATABASE_1_ID, USER_3_ID);
@@ -416,7 +419,7 @@ public class ViewEndpointUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(credentialService.getView(DATABASE_1_ID, VIEW_3_ID))
-                .thenReturn(VIEW_3_DTO);
+                .thenReturn(VIEW_3_PRIVILEGED_DTO);
         doThrow(NotAllowedException.class)
                 .when(credentialService)
                 .getAccess(DATABASE_1_ID, USER_1_ID);
diff --git a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/gateway/MetadataServiceGatewayUnitTest.java b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/gateway/MetadataServiceGatewayUnitTest.java
index a2ed7e38174bd9ba2258b5929b010f54313812f6..affb56208032bc818ce5f1dbe1d99008613ffa32 100644
--- a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/gateway/MetadataServiceGatewayUnitTest.java
+++ b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/gateway/MetadataServiceGatewayUnitTest.java
@@ -59,7 +59,7 @@ public class MetadataServiceGatewayUnitTest extends AbstractUnitTest {
         when(internalRestTemplate.exchange(anyString(), eq(HttpMethod.GET), eq(HttpEntity.EMPTY), eq(TableDto.class)))
                 .thenReturn(ResponseEntity.status(HttpStatus.OK)
                         .headers(headers)
-                        .body(TABLE_1_DTO));
+                        .body(TABLE_1_PRIVILEGED_DTO));
 
         /* test */
         final TableDto response = metadataServiceGateway.getTableById(DATABASE_1_ID, TABLE_1_ID);
@@ -105,7 +105,7 @@ public class MetadataServiceGatewayUnitTest extends AbstractUnitTest {
         /* mock */
         when(internalRestTemplate.exchange(anyString(), eq(HttpMethod.GET), eq(HttpEntity.EMPTY), eq(TableDto.class)))
                 .thenReturn(ResponseEntity.status(HttpStatus.NO_CONTENT)
-                        .body(TABLE_1_DTO));
+                        .body(TABLE_1_PRIVILEGED_DTO));
 
         /* test */
         assertThrows(MetadataServiceException.class, () -> {
@@ -115,7 +115,7 @@ public class MetadataServiceGatewayUnitTest extends AbstractUnitTest {
 
     @Test
     public void getTableById_headerMissing_fails() {
-        final List<String> customHeaders = List.of("X-Type", "X-Host", "X-Port", "X-Username", "X-Password", "X-Database", "X-Sidecar-Host", "X-Sidecar-Port");
+        final List<String> customHeaders = List.of("X-Username", "X-Password");
 
         for (int i = 0; i < customHeaders.size(); i++) {
             final HttpHeaders headers = new HttpHeaders();
@@ -126,7 +126,7 @@ public class MetadataServiceGatewayUnitTest extends AbstractUnitTest {
             when(internalRestTemplate.exchange(anyString(), eq(HttpMethod.GET), eq(HttpEntity.EMPTY), eq(TableDto.class)))
                     .thenReturn(ResponseEntity.status(HttpStatus.OK)
                             .headers(headers)
-                            .body(TABLE_1_DTO));
+                            .body(TABLE_1_PRIVILEGED_DTO));
             /* test */
             assertThrows(MetadataServiceException.class, () -> {
                 metadataServiceGateway.getTableById(DATABASE_1_ID, TABLE_1_ID);
@@ -163,7 +163,7 @@ public class MetadataServiceGatewayUnitTest extends AbstractUnitTest {
         when(internalRestTemplate.exchange(anyString(), eq(HttpMethod.GET), eq(HttpEntity.EMPTY), eq(DatabaseDto.class)))
                 .thenReturn(ResponseEntity.ok()
                         .headers(headers)
-                        .body(DATABASE_1_DTO));
+                        .body(DATABASE_1_PRIVILEGED_DTO));
 
         /* test */
         final DatabaseDto response = metadataServiceGateway.getDatabaseById(DATABASE_1_ID);
@@ -359,7 +359,7 @@ public class MetadataServiceGatewayUnitTest extends AbstractUnitTest {
         when(internalRestTemplate.exchange(anyString(), eq(HttpMethod.GET), any(HttpEntity.class), eq(ViewDto.class)))
                 .thenReturn(ResponseEntity.ok()
                         .headers(headers)
-                        .body(VIEW_1_DTO));
+                        .body(VIEW_1_PRIVILEGED_DTO));
 
         /* test */
         final ViewDto response = metadataServiceGateway.getViewById(CONTAINER_1_ID, VIEW_1_ID);
diff --git a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/listener/DefaultListenerIntegrationTest.java b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/listener/DefaultListenerIntegrationTest.java
index 752a9b0e055e8084f29498af07e41f3acabf7794..bca5e1141082e320fe1bef132335fea7e30b7be3 100644
--- a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/listener/DefaultListenerIntegrationTest.java
+++ b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/listener/DefaultListenerIntegrationTest.java
@@ -5,7 +5,7 @@ import at.tuwien.config.MariaDbContainerConfig;
 import at.tuwien.exception.MetadataServiceException;
 import at.tuwien.exception.RemoteUnavailableException;
 import at.tuwien.exception.TableNotFoundException;
-import at.tuwien.gateway.MetadataServiceGateway;
+import at.tuwien.service.CredentialService;
 import at.tuwien.test.AbstractUnitTest;
 import lombok.extern.log4j.Log4j2;
 import org.junit.jupiter.api.BeforeEach;
@@ -42,13 +42,13 @@ import static org.mockito.Mockito.when;
 public class DefaultListenerIntegrationTest extends AbstractUnitTest {
 
     @MockBean
-    private MetadataServiceGateway metadataServiceGateway;
+    private CredentialService credentialService;
 
     @Autowired
     private DefaultListener defaultListener;
 
     @Container
-    private static RabbitMQContainer rabbitContainer = new RabbitMQContainer("rabbitmq:3.10");
+    private static RabbitMQContainer rabbitContainer = new RabbitMQContainer(RABBITMQ_IMAGE);
 
     @Container
     private static MariaDBContainer<?> mariaDBContainer = MariaDbContainerConfig.getContainer();
@@ -67,8 +67,8 @@ public class DefaultListenerIntegrationTest extends AbstractUnitTest {
         final Message request = buildMessage("dbrepo." + DATABASE_1_ID + "." + TABLE_1_ID, "{\"id\":4,\"date\":\"2023-10-03\",\"mintemp\":15.0,\"rainfall\":0.2}", new HashMap<>());
 
         /* mock */
-        when(metadataServiceGateway.getTableById(DATABASE_1_ID, TABLE_1_ID))
-                .thenReturn(TABLE_1_DTO);
+        when(credentialService.getTable(DATABASE_1_ID, TABLE_1_ID))
+                .thenReturn(TABLE_1_PRIVILEGED_DTO);
 
         /* test */
         defaultListener.onMessage(request);
@@ -83,8 +83,8 @@ public class DefaultListenerIntegrationTest extends AbstractUnitTest {
 
         /* mock */
         doThrow(TableNotFoundException.class)
-                .when(metadataServiceGateway)
-                .getTableById(DATABASE_1_ID, TABLE_1_ID);
+                .when(credentialService)
+                .getTable(DATABASE_1_ID, TABLE_1_ID);
 
         /* test */
         defaultListener.onMessage(request);
diff --git a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/listener/DefaultListenerUnitTest.java b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/listener/DefaultListenerUnitTest.java
index 7a439ed55c54442df0e3babb034ce27120c4a208..74042aa5788c38205d8b73abff31aadf162999e3 100644
--- a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/listener/DefaultListenerUnitTest.java
+++ b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/listener/DefaultListenerUnitTest.java
@@ -5,7 +5,7 @@ import at.tuwien.config.MariaDbContainerConfig;
 import at.tuwien.exception.MetadataServiceException;
 import at.tuwien.exception.RemoteUnavailableException;
 import at.tuwien.exception.TableNotFoundException;
-import at.tuwien.gateway.MetadataServiceGateway;
+import at.tuwien.service.CredentialService;
 import at.tuwien.test.AbstractUnitTest;
 import lombok.extern.log4j.Log4j2;
 import org.junit.jupiter.api.BeforeEach;
@@ -38,7 +38,7 @@ import static org.mockito.Mockito.when;
 public class DefaultListenerUnitTest extends AbstractUnitTest {
 
     @MockBean
-    private MetadataServiceGateway metadataServiceGateway;
+    private CredentialService credentialService;
 
     @Autowired
     private DefaultListener defaultListener;
@@ -54,7 +54,7 @@ public class DefaultListenerUnitTest extends AbstractUnitTest {
         genesis();
         /* metadata database */
         MariaDbConfig.dropAllDatabases(CONTAINER_1_PRIVILEGED_DTO);
-        MariaDbConfig.createInitDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_1_DTO);
+        MariaDbConfig.createInitDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_1_PRIVILEGED_DTO);
     }
 
     @Test
@@ -81,8 +81,8 @@ public class DefaultListenerUnitTest extends AbstractUnitTest {
         final Message request = buildMessage("dbrepo.1.1", "{,}", new HashMap<>());
 
         /* mock */
-        when(metadataServiceGateway.getTableById(DATABASE_1_ID, TABLE_1_ID))
-                .thenReturn(TABLE_1_DTO);
+        when(credentialService.getTable(DATABASE_1_ID, TABLE_1_ID))
+                .thenReturn(TABLE_1_PRIVILEGED_DTO);
 
         /* test */
         defaultListener.onMessage(request);
@@ -96,8 +96,8 @@ public class DefaultListenerUnitTest extends AbstractUnitTest {
 
         /* mock */
         doThrow(TableNotFoundException.class)
-                .when(metadataServiceGateway)
-                .getTableById(DATABASE_1_ID, TABLE_1_ID);
+                .when(credentialService)
+                .getTable(DATABASE_1_ID, TABLE_1_ID);
 
         /* test */
         defaultListener.onMessage(request);
diff --git a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/mvc/SubsetEndpointMvcTest.java b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/mvc/SubsetEndpointMvcTest.java
index abbe28d55a328086f4d726360f2e9b5d34929389..158c6743a4e7bac049cae0211fe764030ab4a3f0 100644
--- a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/mvc/SubsetEndpointMvcTest.java
+++ b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/mvc/SubsetEndpointMvcTest.java
@@ -41,8 +41,8 @@ public class SubsetEndpointMvcTest extends AbstractUnitTest {
 
         /* mock */
         when(metadataServiceGateway.getDatabaseById(DATABASE_3_ID))
-                .thenReturn(DATABASE_3_DTO);
-        when(subsetService.findById(DATABASE_3_DTO, QUERY_5_ID))
+                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
+        when(subsetService.findById(DATABASE_3_PRIVILEGED_DTO, QUERY_5_ID))
                 .thenReturn(QUERY_5_DTO);
 
         /* test */
@@ -56,8 +56,8 @@ public class SubsetEndpointMvcTest extends AbstractUnitTest {
 
         /* mock */
         when(metadataServiceGateway.getDatabaseById(DATABASE_3_ID))
-                .thenReturn(DATABASE_3_DTO);
-        when(subsetService.findById(DATABASE_3_DTO, QUERY_5_ID))
+                .thenReturn(DATABASE_3_PRIVILEGED_DTO);
+        when(subsetService.findById(DATABASE_3_PRIVILEGED_DTO, QUERY_5_ID))
                 .thenReturn(QUERY_5_DTO);
 
         /* test */
@@ -72,8 +72,8 @@ public class SubsetEndpointMvcTest extends AbstractUnitTest {
 
         /* mock */
         when(metadataServiceGateway.getDatabaseById(DATABASE_4_ID))
-                .thenReturn(DATABASE_4_DTO);
-        when(subsetService.findById(DATABASE_4_DTO, QUERY_7_ID))
+                .thenReturn(DATABASE_4_PRIVILEGED_DTO);
+        when(subsetService.findById(DATABASE_4_PRIVILEGED_DTO, QUERY_7_ID))
                 .thenReturn(QUERY_5_DTO);
 
         /* test */
diff --git a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/ContainerServiceIntegrationTest.java b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/ContainerServiceIntegrationTest.java
index 251dfe53c5c6a10782c0ec44a674e1fdba8c1e40..e1579fbe95d8d04cbdbe41f87f5dc066b874b26c 100644
--- a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/ContainerServiceIntegrationTest.java
+++ b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/ContainerServiceIntegrationTest.java
@@ -42,17 +42,22 @@ public class ContainerServiceIntegrationTest extends AbstractUnitTest {
     }
 
     @BeforeEach
-    public void beforeEach() throws SQLException {
+    public void beforeEach() throws SQLException, InterruptedException {
         genesis();
         /* metadata database */
         MariaDbConfig.dropDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_1_INTERNALNAME);
+        MariaDbConfig.createDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_1_INTERNALNAME);
+        Thread.sleep(1000) /* wait for test container some more */;
     }
 
     @Test
     public void create_succeeds() throws SQLException, DatabaseMalformedException {
 
+        /* mock */
+        MariaDbConfig.dropDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_1_INTERNALNAME);
+
         /* test */
-        final DatabaseDto response = containerService.createDatabase(CONTAINER_1_DTO, DATABASE_1_CREATE_INTERNAL);
+        final DatabaseDto response = containerService.createDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_1_CREATE_INTERNAL);
         assertNull(response.getName());
         assertEquals(DATABASE_1_INTERNALNAME, response.getInternalName());
         assertEquals(EXCHANGE_DBREPO_NAME, response.getExchangeName());
@@ -65,45 +70,26 @@ public class ContainerServiceIntegrationTest extends AbstractUnitTest {
     }
 
     @Test
-    public void create_exists_fails() throws SQLException {
-
-        /* mock */
-        MariaDbConfig.createDatabase(CONTAINER_1_DTO, DATABASE_1_INTERNALNAME);
+    public void create_exists_fails() {
 
         /* test */
         assertThrows(DatabaseMalformedException.class, () -> {
-            containerService.createDatabase(CONTAINER_1_DTO, DATABASE_1_CREATE_INTERNAL);
+            containerService.createDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_1_CREATE_INTERNAL);
         });
     }
 
     @Test
     public void createQueryStore_succeeds() throws SQLException, QueryStoreCreateException, InterruptedException {
 
-        /* mock */
-        MariaDbConfig.dropQueryStore(DATABASE_1_DTO);
-
         /* test */
         createQueryStore_generic(DATABASE_1_INTERNALNAME);
     }
 
-    @Test
-    public void createQueryStore_fails() {
-
-        /* test */
-        assertThrows(QueryStoreCreateException.class, () -> {
-            createQueryStore_generic(DATABASE_1_INTERNALNAME);
-        });
-    }
-
-    protected void createQueryStore_generic(String databaseName) throws SQLException, QueryStoreCreateException,
-            InterruptedException {
-
-        /* pre-condition */
-        Thread.sleep(1000) /* wait for test container some more */;
+    protected void createQueryStore_generic(String databaseName) throws SQLException, QueryStoreCreateException {
 
         /* test */
-        containerService.createQueryStore(CONTAINER_1_DTO, databaseName);
-        final List<Map<String, Object>> response = MariaDbConfig.listQueryStore(DATABASE_1_DTO);
+        containerService.createQueryStore(CONTAINER_1_PRIVILEGED_DTO, databaseName);
+        final List<Map<String, Object>> response = MariaDbConfig.listQueryStore(DATABASE_1_PRIVILEGED_DTO);
         assertEquals(0, response.size());
     }
 }
diff --git a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/CredentialServiceUnitTest.java b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/CredentialServiceUnitTest.java
index 8b5e2cc7c5c5e1becf569bafcd0af6b9c3f13b66..07e283640a92bd68a774158d196578a0ab9fd23d 100644
--- a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/CredentialServiceUnitTest.java
+++ b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/CredentialServiceUnitTest.java
@@ -48,7 +48,7 @@ public class CredentialServiceUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(metadataServiceGateway.getDatabaseById(DATABASE_1_ID))
-                .thenReturn(DATABASE_1_DTO);
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
 
         /* test */
         final DatabaseDto response = credentialService.getDatabase(DATABASE_1_ID);
@@ -62,7 +62,7 @@ public class CredentialServiceUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(metadataServiceGateway.getDatabaseById(DATABASE_1_ID))
-                .thenReturn(DATABASE_1_DTO)
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO)
                 .thenThrow(RuntimeException.class) /* should never be thrown */;
         credentialService.getDatabase(DATABASE_1_ID);
 
@@ -78,8 +78,8 @@ public class CredentialServiceUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(metadataServiceGateway.getDatabaseById(DATABASE_1_ID))
-                .thenReturn(DATABASE_2_DTO) /* needs to be different id for test case */
-                .thenReturn(DATABASE_1_DTO);
+                .thenReturn(DATABASE_2_PRIVILEGED_DTO) /* needs to be different id for test case */
+                .thenReturn(DATABASE_1_PRIVILEGED_DTO);
 
         /* pre-condition */
         final DatabaseDto tmp = credentialService.getDatabase(DATABASE_1_ID);
@@ -98,7 +98,7 @@ public class CredentialServiceUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(metadataServiceGateway.getContainerById(CONTAINER_1_ID))
-                .thenReturn(CONTAINER_1_DTO);
+                .thenReturn(CONTAINER_1_PRIVILEGED_DTO);
 
         /* test */
         final ContainerDto response = credentialService.getContainer(CONTAINER_1_ID);
@@ -128,8 +128,8 @@ public class CredentialServiceUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(metadataServiceGateway.getContainerById(DATABASE_1_ID))
-                .thenReturn(CONTAINER_2_DTO) /* needs to be different id for test case */
-                .thenReturn(CONTAINER_1_DTO);
+                .thenReturn(CONTAINER_2_PRIVILEGED_DTO) /* needs to be different id for test case */
+                .thenReturn(CONTAINER_1_PRIVILEGED_DTO);
 
         /* pre-condition */
         final ContainerDto tmp = credentialService.getContainer(CONTAINER_1_ID);
@@ -251,7 +251,7 @@ public class CredentialServiceUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(metadataServiceGateway.getTableById(DATABASE_1_ID, TABLE_1_ID))
-                .thenReturn(TABLE_1_DTO);
+                .thenReturn(TABLE_1_PRIVILEGED_DTO);
 
         /* test */
         final TableDto response = credentialService.getTable(DATABASE_1_ID, TABLE_1_ID);
@@ -265,7 +265,7 @@ public class CredentialServiceUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(metadataServiceGateway.getTableById(DATABASE_1_ID, TABLE_1_ID))
-                .thenReturn(TABLE_1_DTO)
+                .thenReturn(TABLE_1_PRIVILEGED_DTO)
                 .thenThrow(RuntimeException.class) /* should never be thrown */;
         credentialService.getTable(DATABASE_1_ID, TABLE_1_ID);
 
@@ -281,8 +281,8 @@ public class CredentialServiceUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(metadataServiceGateway.getTableById(DATABASE_1_ID, TABLE_1_ID))
-                .thenReturn(TABLE_2_DTO) /* needs to be different id for test case */
-                .thenReturn(TABLE_1_DTO);
+                .thenReturn(TABLE_2_PRIVILEGED_DTO) /* needs to be different id for test case */
+                .thenReturn(TABLE_1_PRIVILEGED_DTO);
 
         /* pre-condition */
         final TableDto tmp = credentialService.getTable(DATABASE_1_ID, TABLE_1_ID);
@@ -301,7 +301,7 @@ public class CredentialServiceUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(metadataServiceGateway.getViewById(DATABASE_1_ID, VIEW_1_ID))
-                .thenReturn(VIEW_1_DTO);
+                .thenReturn(VIEW_1_PRIVILEGED_DTO);
 
         /* test */
         final ViewDto response = credentialService.getView(DATABASE_1_ID, VIEW_1_ID);
@@ -314,7 +314,7 @@ public class CredentialServiceUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(metadataServiceGateway.getViewById(DATABASE_1_ID, VIEW_1_ID))
-                .thenReturn(VIEW_1_DTO)
+                .thenReturn(VIEW_1_PRIVILEGED_DTO)
                 .thenThrow(RuntimeException.class) /* should never be thrown */;
         credentialService.getView(DATABASE_1_ID, VIEW_1_ID);
 
@@ -330,8 +330,8 @@ public class CredentialServiceUnitTest extends AbstractUnitTest {
 
         /* mock */
         when(metadataServiceGateway.getViewById(DATABASE_1_ID, VIEW_1_ID))
-                .thenReturn(VIEW_2_DTO) /* needs to be different id for test case */
-                .thenReturn(VIEW_1_DTO);
+                .thenReturn(VIEW_2_PRIVILEGED_DTO) /* needs to be different id for test case */
+                .thenReturn(VIEW_1_PRIVILEGED_DTO);
 
         /* pre-condition */
         final ViewDto tmp = credentialService.getView(DATABASE_1_ID, VIEW_1_ID);
diff --git a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/DatabaseServiceIntegrationTest.java b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/DatabaseServiceIntegrationTest.java
index 550589df794b5839e37b359f4a1b97992d410309..6663a71d135033e5fb4a3b3810d04d54130e270a 100644
--- a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/DatabaseServiceIntegrationTest.java
+++ b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/DatabaseServiceIntegrationTest.java
@@ -60,31 +60,36 @@ public class DatabaseServiceIntegrationTest extends AbstractUnitTest {
     }
 
     @BeforeEach
-    public void beforeEach() throws SQLException {
+    public void beforeEach() throws SQLException, InterruptedException {
         genesis();
         /* metadata database */
         MariaDbConfig.dropDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_1_INTERNALNAME);
+        MariaDbConfig.createInitDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_1_DTO);
+        MariaDbConfig.dropDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_2_INTERNALNAME);
+        MariaDbConfig.createInitDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_2_DTO);
+        Thread.sleep(1000) /* wait for test container some more */;
     }
 
     @Test
     public void createView_succeeds() throws SQLException, ViewMalformedException {
 
         /* test */
-        databaseService.createView(DATABASE_1_DTO, VIEW_1_CREATE_DTO);
+        databaseService.createView(DATABASE_1_PRIVILEGED_DTO, VIEW_1_CREATE_DTO);
     }
 
     @Test
     public void exploreViews_succeeds() throws SQLException, ViewNotFoundException, DatabaseMalformedException {
 
         /* test */
-        final List<ViewDto> response = databaseService.exploreViews(DATABASE_1_DTO);
+        final List<ViewDto> response = databaseService.exploreViews(DATABASE_1_PRIVILEGED_DTO);
         final ViewDto view0 = response.get(0);
         assertEquals("not_in_metadata_db2", view0.getName());
         assertEquals("not_in_metadata_db2", view0.getInternalName());
         assertEquals(DATABASE_1_ID, view0.getVdbid());
-        assertEquals(DATABASE_1_OWNER, view0.getOwner().getId());
+        assertEquals(USER_1_BRIEF_DTO, view0.getOwner());
         assertFalse(view0.getIsInitialView());
         assertEquals(DATABASE_1_PUBLIC, view0.getIsPublic());
+        assertEquals(DATABASE_1_SCHEMA_PUBLIC, view0.getIsSchemaPublic());
         assertTrue(view0.getQuery().length() >= 69);
         assertNotNull(view0.getQueryHash());
         assertEquals(4, view0.getColumns().size());
@@ -106,8 +111,7 @@ public class DatabaseServiceIntegrationTest extends AbstractUnitTest {
                 .build();
 
         /* mock */
-        MariaDbConfig.createInitDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_1_DTO);
-        MariaDbConfig.grantWriteAccess(DATABASE_1_DTO, USER_1_USERNAME);
+        MariaDbConfig.grantWriteAccess(DATABASE_1_PRIVILEGED_DTO, USER_1_USERNAME);
 
         /* pre-condition */
         MariaDbConfig.mockQuery(CONTAINER_1_HOST, CONTAINER_1_PORT, DATABASE_1_INTERNALNAME, "CREATE SEQUENCE debug NOCACHE", USER_1_USERNAME, USER_1_PASSWORD);
@@ -119,34 +123,31 @@ public class DatabaseServiceIntegrationTest extends AbstractUnitTest {
         }
 
         /* test */
-        databaseService.update(DATABASE_1_DTO, request);
+        databaseService.update(DATABASE_1_PRIVILEGED_DTO, request);
         MariaDbConfig.mockQuery(CONTAINER_1_HOST, CONTAINER_1_PORT, DATABASE_1_INTERNALNAME, "CREATE SEQUENCE debug2 NOCACHE", USER_1_USERNAME, USER_2_PASSWORD);
     }
 
     @Test
-    public void update_notExists_fails() throws SQLException {
+    public void update_notExists_fails() {
         final UpdateUserPasswordDto request = UpdateUserPasswordDto.builder()
                 .username("i_do_not_exist")
                 .password(USER_1_PASSWORD)
                 .build();
 
-        /* mock */
-        MariaDbConfig.createInitDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_1_DTO);
-
         /* test */
         assertThrows(DatabaseMalformedException.class, () -> {
-            databaseService.update(DATABASE_1_DTO, request);
+            databaseService.update(DATABASE_1_PRIVILEGED_DTO, request);
         });
     }
-    
+
     @Test
     public void inspectTable_sameNameDifferentDb_succeeds() throws TableNotFoundException, SQLException {
 
         /* mock */
-        MariaDbConfig.execute(DATABASE_2_DTO, "CREATE TABLE not_in_metadata_db (wrong_id BIGINT NOT NULL PRIMARY KEY, given_name VARCHAR(255) NOT NULL, middle_name VARCHAR(255), family_name VARCHAR(255) NOT NULL, age INT NOT NULL) WITH SYSTEM VERSIONING;");
+        MariaDbConfig.execute(DATABASE_2_PRIVILEGED_DTO, "CREATE TABLE not_in_metadata_db (wrong_id BIGINT NOT NULL PRIMARY KEY, given_name VARCHAR(255) NOT NULL, middle_name VARCHAR(255), family_name VARCHAR(255) NOT NULL, age INT NOT NULL) WITH SYSTEM VERSIONING;");
 
         /* test */
-        final TableDto response = databaseService.inspectTable(DATABASE_1_DTO, "not_in_metadata_db");
+        final TableDto response = databaseService.inspectTable(DATABASE_1_PRIVILEGED_DTO, "not_in_metadata_db");
         assertEquals("not_in_metadata_db", response.getInternalName());
         assertEquals("not_in_metadata_db", response.getName());
         assertEquals(DATABASE_1_ID, response.getTdbid());
@@ -182,7 +183,7 @@ public class DatabaseServiceIntegrationTest extends AbstractUnitTest {
     public void inspectTableEnum_succeeds() throws TableNotFoundException, SQLException {
 
         /* test */
-        final TableDto response = databaseService.inspectTable(DATABASE_2_DTO, "experiments");
+        final TableDto response = databaseService.inspectTable(DATABASE_2_PRIVILEGED_DTO, "experiments");
         assertEquals("experiments", response.getInternalName());
         assertEquals("experiments", response.getName());
         assertEquals(DATABASE_2_ID, response.getTdbid());
@@ -215,14 +216,14 @@ public class DatabaseServiceIntegrationTest extends AbstractUnitTest {
     public void inspectTableFullConstraints_succeeds() throws TableNotFoundException, SQLException {
 
         /* test */
-        final TableDto response = databaseService.inspectTable(DATABASE_1_DTO, "weather_aus");
+        final TableDto response = databaseService.inspectTable(DATABASE_1_PRIVILEGED_DTO, "weather_aus");
         assertEquals("weather_aus", response.getInternalName());
         assertEquals("weather_aus", response.getName());
         assertEquals(DATABASE_1_ID, response.getTdbid());
         assertTrue(response.getIsVersioned());
         assertEquals(DATABASE_1_PUBLIC, response.getIsPublic());
         assertNotNull(response.getOwner());
-        assertEquals(DATABASE_1_OWNER, response.getOwner().getId());
+        assertEquals(USER_1_BRIEF_DTO, response.getOwner());
         assertEquals(USER_1_NAME, response.getOwner().getName());
         assertEquals(USER_1_USERNAME, response.getOwner().getUsername());
         assertEquals(USER_1_FIRSTNAME, response.getOwner().getFirstname());
@@ -315,7 +316,7 @@ public class DatabaseServiceIntegrationTest extends AbstractUnitTest {
     public void inspectTable_multipleForeignKeyReferences_succeeds() throws TableNotFoundException, SQLException {
 
         /* test */
-        final TableDto response = databaseService.inspectTable(DATABASE_1_DTO, "complex_foreign_keys");
+        final TableDto response = databaseService.inspectTable(DATABASE_1_PRIVILEGED_DTO, "complex_foreign_keys");
         final ConstraintsDto constraints = response.getConstraints();
         final List<ForeignKeyDto> foreignKeys = constraints.getForeignKeys();
         assertEquals(1, foreignKeys.size());
@@ -368,7 +369,7 @@ public class DatabaseServiceIntegrationTest extends AbstractUnitTest {
     public void inspectTable_multiplePrimaryKey_succeeds() throws TableNotFoundException, SQLException {
 
         /* test */
-        final TableDto response = databaseService.inspectTable(DATABASE_1_DTO, "complex_primary_key");
+        final TableDto response = databaseService.inspectTable(DATABASE_1_PRIVILEGED_DTO, "complex_primary_key");
         final ConstraintsDto constraints = response.getConstraints();
         final List<PrimaryKeyDto> primaryKey = new LinkedList<>(constraints.getPrimaryKey());
         assertEquals(2, primaryKey.size());
@@ -406,7 +407,7 @@ public class DatabaseServiceIntegrationTest extends AbstractUnitTest {
     public void inspectTable_exoticBoolean_succeeds() throws TableNotFoundException, SQLException {
 
         /* test */
-        final TableDto response = databaseService.inspectTable(DATABASE_1_DTO, "exotic_boolean");
+        final TableDto response = databaseService.inspectTable(DATABASE_1_PRIVILEGED_DTO, "exotic_boolean");
         final ConstraintsDto constraints = response.getConstraints();
         final List<PrimaryKeyDto> primaryKey = new LinkedList<>(constraints.getPrimaryKey());
         assertEquals(1, primaryKey.size());
@@ -435,11 +436,11 @@ public class DatabaseServiceIntegrationTest extends AbstractUnitTest {
     public void inspectView_succeeds() throws SQLException, ViewNotFoundException {
 
         /* test */
-        final ViewDto response = databaseService.inspectView(DATABASE_1_DTO, "not_in_metadata_db2");
+        final ViewDto response = databaseService.inspectView(DATABASE_1_PRIVILEGED_DTO, "not_in_metadata_db2");
         assertEquals("not_in_metadata_db2", response.getInternalName());
         assertEquals("not_in_metadata_db2", response.getName());
         assertEquals(DATABASE_1_ID, response.getVdbid());
-        assertEquals(DATABASE_1_OWNER, response.getOwner().getId());
+        assertEquals(USER_1_BRIEF_DTO, response.getOwner());
         assertFalse(response.getIsInitialView());
         assertEquals(DATABASE_1_PUBLIC, response.getIsPublic());
         assertTrue(response.getQuery().length() >= 69);
@@ -467,7 +468,7 @@ public class DatabaseServiceIntegrationTest extends AbstractUnitTest {
     public void getSchemas_succeeds() throws TableNotFoundException, SQLException, DatabaseMalformedException {
 
         /* test */
-        final List<TableDto> response = databaseService.exploreTables(DATABASE_1_DTO);
+        final List<TableDto> response = databaseService.exploreTables(DATABASE_1_PRIVILEGED_DTO);
         assertEquals(4, response.size());
         final TableDto table0 = response.get(0);
         Assertions.assertEquals("complex_foreign_keys", table0.getInternalName());
@@ -599,8 +600,8 @@ public class DatabaseServiceIntegrationTest extends AbstractUnitTest {
             TableExistsException {
 
         /* test */
-        final TableDto response = databaseService.createTable(DATABASE_1_DTO, TABLE_4_CREATE_INTERNAL_DTO);
-        assertEquals(TABLE_4_NAME, response.getName());
+        final TableDto response = databaseService.createTable(DATABASE_1_PRIVILEGED_DTO, TABLE_4_CREATE_INTERNAL_DTO);
+        assertEquals(TABLE_4_INTERNALNAME, response.getName());
         assertEquals(TABLE_4_INTERNALNAME, response.getInternalName());
         final List<ColumnDto> columns = response.getColumns();
         assertEquals(TABLE_4_COLUMNS.size(), columns.size());
@@ -630,7 +631,7 @@ public class DatabaseServiceIntegrationTest extends AbstractUnitTest {
 
         /* test */
         assertThrows(TableMalformedException.class, () -> {
-            databaseService.createTable(DATABASE_1_DTO, request);
+            databaseService.createTable(DATABASE_1_PRIVILEGED_DTO, request);
         });
     }
 
@@ -668,7 +669,7 @@ public class DatabaseServiceIntegrationTest extends AbstractUnitTest {
                 .build();
 
         /* test */
-        final TableDto response = databaseService.createTable(DATABASE_1_DTO, request);
+        final TableDto response = databaseService.createTable(DATABASE_1_PRIVILEGED_DTO, request);
         assertEquals("composite_primary_key", response.getName());
         assertEquals("composite_primary_key", response.getInternalName());
         final List<ColumnDto> columns = response.getColumns();
@@ -699,11 +700,11 @@ public class DatabaseServiceIntegrationTest extends AbstractUnitTest {
             TableExistsException {
 
         /* mock */
-        MariaDbConfig.dropTable(DATABASE_1_DTO, TABLE_1_INTERNAL_NAME);
+        MariaDbConfig.dropTable(DATABASE_1_PRIVILEGED_DTO, TABLE_1_INTERNAL_NAME);
 
         /* test */
-        final TableDto response = databaseService.createTable(DATABASE_1_DTO, TABLE_1_CREATE_INTERNAL_DTO);
-        assertEquals(TABLE_1_NAME, response.getName());
+        final TableDto response = databaseService.createTable(DATABASE_1_PRIVILEGED_DTO, TABLE_1_CREATE_INTERNAL_DTO);
+        assertEquals(TABLE_1_INTERNAL_NAME, response.getName());
         assertEquals(TABLE_1_INTERNAL_NAME, response.getInternalName());
         assertEquals(TABLE_1_COLUMNS.size(), response.getColumns().size());
     }
diff --git a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/QueueServiceIntegrationTest.java b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/QueueServiceIntegrationTest.java
index fc9860909f8c885a2ee3135597cae0e43b11c8dc..18b2dd8e01bc8d8e10f1de9bea9798846868bc6d 100644
--- a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/QueueServiceIntegrationTest.java
+++ b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/QueueServiceIntegrationTest.java
@@ -53,7 +53,7 @@ public class QueueServiceIntegrationTest extends AbstractUnitTest {
         genesis();
         /* metadata database */
         MariaDbConfig.dropDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_1_INTERNALNAME);
-        MariaDbConfig.createInitDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_1_DTO);
+        MariaDbConfig.createInitDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_1_PRIVILEGED_DTO);
     }
 
     @Test
@@ -69,12 +69,12 @@ public class QueueServiceIntegrationTest extends AbstractUnitTest {
 
         /* mock */
         when(metadataServiceGateway.getContainerById(CONTAINER_1_ID))
-                .thenReturn(CONTAINER_1_DTO);
+                .thenReturn(CONTAINER_1_PRIVILEGED_DTO);
         when(metadataServiceGateway.getTableById(DATABASE_1_ID, TABLE_1_ID))
-                .thenReturn(TABLE_1_DTO);
+                .thenReturn(TABLE_1_PRIVILEGED_DTO);
 
         /* test */
-        queueService.insert(TABLE_1_DTO, request);
+        queueService.insert(TABLE_1_PRIVILEGED_DTO, request);
     }
 
     @Test
@@ -87,10 +87,10 @@ public class QueueServiceIntegrationTest extends AbstractUnitTest {
 
         /* mock */
         when(metadataServiceGateway.getTableById(DATABASE_1_ID, TABLE_1_ID))
-                .thenReturn(TABLE_1_DTO);
+                .thenReturn(TABLE_1_PRIVILEGED_DTO);
 
         /* test */
-        queueService.insert(TABLE_1_DTO, request);
+        queueService.insert(TABLE_1_PRIVILEGED_DTO, request);
     }
 
 }
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 ea58aa1da4cae16928354f18385b149a69c90ae9..56115690b503ce3c71bb241fdd84704710a0bb0b 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
@@ -45,7 +45,7 @@ public class SubsetServiceIntegrationTest extends AbstractUnitTest {
         genesis();
         /* metadata database */
         MariaDbConfig.dropDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_1_INTERNALNAME);
-        MariaDbConfig.createInitDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_1_DTO);
+        MariaDbConfig.createInitDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_1_PRIVILEGED_DTO);
     }
 
     @Test
@@ -107,7 +107,7 @@ public class SubsetServiceIntegrationTest extends AbstractUnitTest {
 
         /* test */
         persist_generic(QUERY_2_ID, List.of(IDENTIFIER_5_BRIEF_DTO), true);
-        final QueryDto response = queryService.findById(DATABASE_1_DTO, QUERY_2_ID);
+        final QueryDto response = queryService.findById(DATABASE_1_PRIVILEGED_DTO, QUERY_2_ID);
         assertEquals(2L, response.getId());
         assertTrue(response.getIsPersisted());
     }
@@ -123,7 +123,7 @@ public class SubsetServiceIntegrationTest extends AbstractUnitTest {
 
         /* test */
         persist_generic(QUERY_1_ID, List.of(IDENTIFIER_2_BRIEF_DTO), false);
-        final QueryDto response = queryService.findById(DATABASE_1_DTO, QUERY_1_ID);
+        final QueryDto response = queryService.findById(DATABASE_1_PRIVILEGED_DTO, QUERY_1_ID);
         assertEquals(1L, response.getId());
         assertFalse(response.getIsPersisted());
     }
@@ -140,10 +140,10 @@ public class SubsetServiceIntegrationTest extends AbstractUnitTest {
                 .thenReturn(List.of(IDENTIFIER_2_BRIEF_DTO));
         when(metadataServiceGateway.getUserById(USER_1_ID))
                 .thenReturn(USER_1_DTO);
-        MariaDbConfig.insertQueryStore(DATABASE_1_DTO, QUERY_1_DTO, USER_1_ID);
+        MariaDbConfig.insertQueryStore(DATABASE_1_PRIVILEGED_DTO, QUERY_1_DTO, USER_1_ID);
 
         /* test */
-        final QueryDto response = queryService.findById(DATABASE_1_DTO, queryId);
+        final QueryDto response = queryService.findById(DATABASE_1_PRIVILEGED_DTO, queryId);
         assertEquals(QUERY_1_ID, response.getId());
     }
 
@@ -155,13 +155,13 @@ public class SubsetServiceIntegrationTest extends AbstractUnitTest {
         Thread.sleep(1000) /* wait for test container some more */;
 
         /* mock */
-        MariaDbConfig.insertQueryStore(DATABASE_1_DTO, QUERY_1_DTO, USER_1_ID);
-        MariaDbConfig.insertQueryStore(DATABASE_1_DTO, QUERY_2_DTO, USER_1_ID);
+        MariaDbConfig.insertQueryStore(DATABASE_1_PRIVILEGED_DTO, QUERY_1_DTO, USER_1_ID);
+        MariaDbConfig.insertQueryStore(DATABASE_1_PRIVILEGED_DTO, QUERY_2_DTO, USER_1_ID);
         when(metadataServiceGateway.getIdentifiers(DATABASE_1_ID, null))
                 .thenReturn(List.of(IDENTIFIER_2_BRIEF_DTO, IDENTIFIER_5_BRIEF_DTO));
 
         /* test */
-        return queryService.findAll(DATABASE_1_DTO, filterPersisted);
+        return queryService.findAll(DATABASE_1_PRIVILEGED_DTO, filterPersisted);
     }
 
     protected void persist_generic(Long queryId, List<IdentifierBriefDto> identifiers, Boolean persist)
@@ -174,11 +174,11 @@ public class SubsetServiceIntegrationTest extends AbstractUnitTest {
         /* mock */
         when(metadataServiceGateway.getIdentifiers(DATABASE_1_ID, queryId))
                 .thenReturn(identifiers);
-        MariaDbConfig.insertQueryStore(DATABASE_1_DTO, QUERY_1_DTO, USER_1_ID);
-        MariaDbConfig.insertQueryStore(DATABASE_1_DTO, QUERY_2_DTO, USER_1_ID);
+        MariaDbConfig.insertQueryStore(DATABASE_1_PRIVILEGED_DTO, QUERY_1_DTO, USER_1_ID);
+        MariaDbConfig.insertQueryStore(DATABASE_1_PRIVILEGED_DTO, QUERY_2_DTO, USER_1_ID);
 
         /* test */
-        queryService.persist(DATABASE_1_DTO, queryId, persist);
+        queryService.persist(DATABASE_1_PRIVILEGED_DTO, queryId, persist);
     }
 
 }
diff --git a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/TableServiceIntegrationTest.java b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/TableServiceIntegrationTest.java
index e29e418ca88fef7d49a2ee8ba1f574339db6aef5..f235f39d63a905e34017933bcc6365c85a299442 100644
--- a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/TableServiceIntegrationTest.java
+++ b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/TableServiceIntegrationTest.java
@@ -7,7 +7,6 @@ import at.tuwien.config.MariaDbConfig;
 import at.tuwien.config.MariaDbContainerConfig;
 import at.tuwien.config.S3Config;
 import at.tuwien.exception.*;
-import at.tuwien.gateway.MetadataServiceGateway;
 import at.tuwien.test.AbstractUnitTest;
 import com.google.common.io.Files;
 import lombok.extern.log4j.Log4j2;
@@ -18,7 +17,6 @@ import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.ExtendWith;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
-import org.springframework.boot.test.mock.mockito.MockBean;
 import org.springframework.test.context.DynamicPropertyRegistry;
 import org.springframework.test.context.DynamicPropertySource;
 import org.springframework.test.context.junit.jupiter.SpringExtension;
@@ -42,7 +40,6 @@ import java.util.Map;
 import java.util.Set;
 
 import static org.junit.jupiter.api.Assertions.*;
-import static org.mockito.Mockito.when;
 
 @Log4j2
 @SpringBootTest
@@ -59,9 +56,6 @@ public class TableServiceIntegrationTest extends AbstractUnitTest {
     @Autowired
     private S3Config s3Config;
 
-    @MockBean
-    private MetadataServiceGateway metadataServiceGateway;
-
     @Container
     private static MariaDBContainer<?> mariaDBContainer = MariaDbContainerConfig.getContainer();
 
@@ -85,8 +79,8 @@ public class TableServiceIntegrationTest extends AbstractUnitTest {
         MariaDbConfig.dropDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_1_INTERNALNAME);
         MariaDbConfig.dropDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_2_INTERNALNAME);
         MariaDbConfig.dropDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_3_INTERNALNAME);
-        MariaDbConfig.createInitDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_1_DTO);
-        MariaDbConfig.createInitDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_3_DTO);
+        MariaDbConfig.createInitDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_1_PRIVILEGED_DTO);
+        MariaDbConfig.createInitDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_3_PRIVILEGED_DTO);
         /* s3 */
         if (s3Client.listBuckets().buckets().stream().noneMatch(b -> b.name().equals(s3Config.getS3Bucket()))) {
             s3Client.createBucket(CreateBucketRequest.builder()
@@ -101,8 +95,7 @@ public class TableServiceIntegrationTest extends AbstractUnitTest {
     }
 
     @Test
-    public void updateTuple_succeeds() throws SQLException, RemoteUnavailableException, ContainerNotFoundException,
-            TableNotFoundException, TableMalformedException, QueryMalformedException, MetadataServiceException {
+    public void updateTuple_succeeds() throws SQLException, TableMalformedException, QueryMalformedException {
         /* modify row based on primary key */
         final TupleUpdateDto request = TupleUpdateDto.builder()
                 .data(new HashMap<>() {{
@@ -116,15 +109,9 @@ public class TableServiceIntegrationTest extends AbstractUnitTest {
                 }})
                 .build();
 
-        /* mock */
-        when(metadataServiceGateway.getContainerById(CONTAINER_1_ID))
-                .thenReturn(CONTAINER_1_DTO);
-        when(metadataServiceGateway.getTableById(DATABASE_1_ID, TABLE_1_ID))
-                .thenReturn(TABLE_1_DTO);
-
         /* test */
-        tableService.updateTuple(TABLE_1_DTO, request);
-        final List<Map<String, String>> result = MariaDbConfig.selectQuery(DATABASE_1_DTO, "SELECT id, `date`, location, mintemp, rainfall FROM weather_aus WHERE id = 1", Set.of("id", "date", "location", "mintemp", "rainfall"));
+        tableService.updateTuple(TABLE_1_PRIVILEGED_DTO, request);
+        final List<Map<String, String>> result = MariaDbConfig.selectQuery(DATABASE_1_PRIVILEGED_DTO, "SELECT id, `date`, location, mintemp, rainfall FROM weather_aus WHERE id = 1", Set.of("id", "date", "location", "mintemp", "rainfall"));
         assertEquals("1", result.get(0).get("id"));
         assertEquals("2023-10-03", result.get(0).get("date")); // <<<
         assertEquals("Vienna", result.get(0).get("location")); // <<<
@@ -133,9 +120,8 @@ public class TableServiceIntegrationTest extends AbstractUnitTest {
     }
 
     @Test
-    public void updateTuple_modifyPrimaryKey_succeeds() throws SQLException, RemoteUnavailableException,
-            ContainerNotFoundException, TableNotFoundException, TableMalformedException, QueryMalformedException,
-            MetadataServiceException {
+    public void updateTuple_modifyPrimaryKey_succeeds() throws SQLException, TableMalformedException,
+            QueryMalformedException {
         /* modify row primary key based on primary key */
         final TupleUpdateDto request = TupleUpdateDto.builder()
                 .data(new HashMap<>() {{
@@ -150,15 +136,9 @@ public class TableServiceIntegrationTest extends AbstractUnitTest {
                 }})
                 .build();
 
-        /* mock */
-        when(metadataServiceGateway.getContainerById(CONTAINER_1_ID))
-                .thenReturn(CONTAINER_1_DTO);
-        when(metadataServiceGateway.getTableById(DATABASE_1_ID, TABLE_1_ID))
-                .thenReturn(TABLE_1_DTO);
-
         /* test */
-        tableService.updateTuple(TABLE_1_DTO, request);
-        final List<Map<String, String>> result = MariaDbConfig.selectQuery(DATABASE_1_DTO, "SELECT id, `date`, location, mintemp, rainfall FROM weather_aus WHERE id = 4", Set.of("id", "date", "location", "mintemp", "rainfall"));
+        tableService.updateTuple(TABLE_1_PRIVILEGED_DTO, request);
+        final List<Map<String, String>> result = MariaDbConfig.selectQuery(DATABASE_1_PRIVILEGED_DTO, "SELECT id, `date`, location, mintemp, rainfall FROM weather_aus WHERE id = 4", Set.of("id", "date", "location", "mintemp", "rainfall"));
         assertEquals("4", result.get(0).get("id"));
         assertEquals("2023-10-03", result.get(0).get("date")); // <<<
         assertEquals("Vienna", result.get(0).get("location")); // <<<
@@ -167,9 +147,8 @@ public class TableServiceIntegrationTest extends AbstractUnitTest {
     }
 
     @Test
-    public void updateTuple_missingPrimaryKey_succeeds() throws SQLException, RemoteUnavailableException,
-            ContainerNotFoundException, TableNotFoundException, TableMalformedException, QueryMalformedException,
-            MetadataServiceException {
+    public void updateTuple_missingPrimaryKey_succeeds() throws SQLException, TableMalformedException,
+            QueryMalformedException {
         /* modify row based on non-primary key column */
         final TupleUpdateDto request = TupleUpdateDto.builder()
                 .data(new HashMap<>() {{
@@ -183,15 +162,9 @@ public class TableServiceIntegrationTest extends AbstractUnitTest {
                 }})
                 .build();
 
-        /* mock */
-        when(metadataServiceGateway.getContainerById(CONTAINER_1_ID))
-                .thenReturn(CONTAINER_1_DTO);
-        when(metadataServiceGateway.getTableById(DATABASE_1_ID, TABLE_1_ID))
-                .thenReturn(TABLE_1_DTO);
-
         /* test */
-        tableService.updateTuple(TABLE_1_DTO, request);
-        final List<Map<String, String>> result = MariaDbConfig.selectQuery(DATABASE_1_DTO, "SELECT id, `date`, location, mintemp, rainfall FROM weather_aus WHERE id = 1", Set.of("id", "date", "location", "mintemp", "rainfall"));
+        tableService.updateTuple(TABLE_1_PRIVILEGED_DTO, request);
+        final List<Map<String, String>> result = MariaDbConfig.selectQuery(DATABASE_1_PRIVILEGED_DTO, "SELECT id, `date`, location, mintemp, rainfall FROM weather_aus WHERE id = 1", Set.of("id", "date", "location", "mintemp", "rainfall"));
         assertEquals("1", result.get(0).get("id"));
         assertEquals("2023-10-03", result.get(0).get("date")); // <<<
         assertEquals("Vienna", result.get(0).get("location")); // <<<
@@ -200,9 +173,8 @@ public class TableServiceIntegrationTest extends AbstractUnitTest {
     }
 
     @Test
-    public void updateTuple_notInOrder_succeeds() throws SQLException, RemoteUnavailableException,
-            ContainerNotFoundException, TableNotFoundException, TableMalformedException, QueryMalformedException,
-            MetadataServiceException {
+    public void updateTuple_notInOrder_succeeds() throws SQLException, TableMalformedException,
+            QueryMalformedException {
         /* modify row based on non-primary key column */
         final TupleUpdateDto request = TupleUpdateDto.builder()
                 .data(new HashMap<>() {{
@@ -216,15 +188,9 @@ public class TableServiceIntegrationTest extends AbstractUnitTest {
                 }})
                 .build();
 
-        /* mock */
-        when(metadataServiceGateway.getContainerById(CONTAINER_1_ID))
-                .thenReturn(CONTAINER_1_DTO);
-        when(metadataServiceGateway.getTableById(DATABASE_1_ID, TABLE_1_ID))
-                .thenReturn(TABLE_1_DTO);
-
         /* test */
-        tableService.updateTuple(TABLE_1_DTO, request);
-        final List<Map<String, String>> result = MariaDbConfig.selectQuery(DATABASE_1_DTO, "SELECT id, `date`, location, mintemp, rainfall FROM weather_aus WHERE id = 1", Set.of("id", "date", "location", "mintemp", "rainfall"));
+        tableService.updateTuple(TABLE_1_PRIVILEGED_DTO, request);
+        final List<Map<String, String>> result = MariaDbConfig.selectQuery(DATABASE_1_PRIVILEGED_DTO, "SELECT id, `date`, location, mintemp, rainfall FROM weather_aus WHERE id = 1", Set.of("id", "date", "location", "mintemp", "rainfall"));
         assertEquals("1", result.get(0).get("id"));
         assertEquals("2023-10-03", result.get(0).get("date")); // <<<
         assertEquals("Vienna", result.get(0).get("location")); // <<<
@@ -233,9 +199,8 @@ public class TableServiceIntegrationTest extends AbstractUnitTest {
     }
 
     @Test
-    public void createTuple_succeeds() throws SQLException, RemoteUnavailableException, ContainerNotFoundException,
-            TableNotFoundException, TableMalformedException, QueryMalformedException, StorageUnavailableException,
-            StorageNotFoundException, MetadataServiceException {
+    public void createTuple_succeeds() throws SQLException, TableMalformedException, QueryMalformedException,
+            StorageUnavailableException, StorageNotFoundException {
         /* add row with primary key */
         final TupleDto request = TupleDto.builder()
                 .data(new HashMap<>() {{
@@ -247,15 +212,9 @@ public class TableServiceIntegrationTest extends AbstractUnitTest {
                 }})
                 .build();
 
-        /* mock */
-        when(metadataServiceGateway.getContainerById(CONTAINER_1_ID))
-                .thenReturn(CONTAINER_1_DTO);
-        when(metadataServiceGateway.getTableById(DATABASE_1_ID, TABLE_1_ID))
-                .thenReturn(TABLE_1_DTO);
-
         /* test */
-        tableService.createTuple(TABLE_1_DTO, request);
-        final List<Map<String, String>> result = MariaDbConfig.selectQuery(DATABASE_1_DTO, "SELECT id, `date`, location, mintemp, rainfall FROM weather_aus WHERE id = 4", Set.of("id", "date", "location", "mintemp", "rainfall"));
+        tableService.createTuple(TABLE_1_PRIVILEGED_DTO, request);
+        final List<Map<String, String>> result = MariaDbConfig.selectQuery(DATABASE_1_PRIVILEGED_DTO, "SELECT id, `date`, location, mintemp, rainfall FROM weather_aus WHERE id = 4", Set.of("id", "date", "location", "mintemp", "rainfall"));
         assertEquals("4", result.get(0).get("id"));
         assertEquals("2023-10-03", result.get(0).get("date"));
         assertEquals("Vienna", result.get(0).get("location"));
@@ -264,9 +223,8 @@ public class TableServiceIntegrationTest extends AbstractUnitTest {
     }
 
     @Test
-    public void createTuple_autogeneratedBlob_succeeds() throws SQLException, RemoteUnavailableException, ContainerNotFoundException,
-            TableNotFoundException, TableMalformedException, QueryMalformedException, StorageUnavailableException,
-            StorageNotFoundException, MetadataServiceException, IOException {
+    public void createTuple_autogeneratedBlob_succeeds() throws SQLException, TableMalformedException,
+            QueryMalformedException, StorageUnavailableException, StorageNotFoundException, IOException {
         /* add row with primary key */
         final TupleDto request = TupleDto.builder()
                 .data(new HashMap<>() {{
@@ -276,26 +234,21 @@ public class TableServiceIntegrationTest extends AbstractUnitTest {
                 .build();
 
         /* mock */
-        when(metadataServiceGateway.getContainerById(CONTAINER_1_ID))
-                .thenReturn(CONTAINER_1_DTO);
-        when(metadataServiceGateway.getTableById(DATABASE_3_ID, TABLE_8_ID))
-                .thenReturn(TABLE_8_DTO);
         s3Client.putObject(PutObjectRequest.builder()
                 .key("s3key")
                 .bucket(s3Config.getS3Bucket())
                 .build(), RequestBody.fromFile(new File("src/test/resources/csv/keyboard.csv")));
 
         /* test */
-        tableService.createTuple(TABLE_8_DTO, request);
-        final List<Map<String, byte[]>> result = MariaDbConfig.selectQueryByteArr(DATABASE_3_DTO, "SELECT raw FROM mfcc WHERE raw IS NOT NULL", Set.of("raw"));
+        tableService.createTuple(TABLE_8_PRIVILEGED_DTO, request);
+        final List<Map<String, byte[]>> result = MariaDbConfig.selectQueryByteArr(DATABASE_3_PRIVILEGED_DTO, "SELECT raw FROM mfcc WHERE raw IS NOT NULL", Set.of("raw"));
         assertNotNull(result.get(0).get("raw"));
         assertArrayEquals(Files.toByteArray(new File("src/test/resources/csv/keyboard.csv")), result.get(0).get("raw"));
     }
 
     @Test
-    public void createTuple_notInOrder_succeeds() throws SQLException, RemoteUnavailableException,
-            ContainerNotFoundException, TableNotFoundException, TableMalformedException, QueryMalformedException,
-            StorageUnavailableException, StorageNotFoundException, MetadataServiceException {
+    public void createTuple_notInOrder_succeeds() throws SQLException, TableMalformedException, QueryMalformedException,
+            StorageUnavailableException, StorageNotFoundException {
         /* add row with primary key */
         final TupleDto request = TupleDto.builder()
                 .data(new HashMap<>() {{
@@ -307,15 +260,9 @@ public class TableServiceIntegrationTest extends AbstractUnitTest {
                 }})
                 .build();
 
-        /* mock */
-        when(metadataServiceGateway.getContainerById(CONTAINER_1_ID))
-                .thenReturn(CONTAINER_1_DTO);
-        when(metadataServiceGateway.getTableById(DATABASE_1_ID, TABLE_1_ID))
-                .thenReturn(TABLE_1_DTO);
-
         /* test */
-        tableService.createTuple(TABLE_1_DTO, request);
-        final List<Map<String, String>> result = MariaDbConfig.selectQuery(DATABASE_1_DTO, "SELECT id, `date`, location, mintemp, rainfall FROM weather_aus WHERE id = 4", Set.of("id", "date", "location", "mintemp", "rainfall"));
+        tableService.createTuple(TABLE_1_PRIVILEGED_DTO, request);
+        final List<Map<String, String>> result = MariaDbConfig.selectQuery(DATABASE_1_PRIVILEGED_DTO, "SELECT id, `date`, location, mintemp, rainfall FROM weather_aus WHERE id = 4", Set.of("id", "date", "location", "mintemp", "rainfall"));
         assertEquals("4", result.get(0).get("id"));
         assertEquals("2023-10-03", result.get(0).get("date"));
         assertEquals("Vienna", result.get(0).get("location"));
@@ -324,8 +271,7 @@ public class TableServiceIntegrationTest extends AbstractUnitTest {
     }
 
     @Test
-    public void deleteTuple_succeeds() throws SQLException, RemoteUnavailableException, ContainerNotFoundException,
-            TableNotFoundException, TableMalformedException, QueryMalformedException, MetadataServiceException {
+    public void deleteTuple_succeeds() throws SQLException, TableMalformedException, QueryMalformedException {
         /* delete row based on primary key */
         final TupleDeleteDto request = TupleDeleteDto.builder()
                 .keys(new HashMap<>() {{
@@ -333,22 +279,15 @@ public class TableServiceIntegrationTest extends AbstractUnitTest {
                 }})
                 .build();
 
-        /* mock */
-        when(metadataServiceGateway.getContainerById(CONTAINER_1_ID))
-                .thenReturn(CONTAINER_1_DTO);
-        when(metadataServiceGateway.getTableById(DATABASE_1_ID, TABLE_1_ID))
-                .thenReturn(TABLE_1_DTO);
-
         /* test */
-        tableService.deleteTuple(TABLE_1_DTO, request);
-        final List<Map<String, String>> result = MariaDbConfig.selectQuery(DATABASE_1_DTO, "SELECT id FROM weather_aus WHERE id = 1", Set.of("id"));
+        tableService.deleteTuple(TABLE_1_PRIVILEGED_DTO, request);
+        final List<Map<String, String>> result = MariaDbConfig.selectQuery(DATABASE_1_PRIVILEGED_DTO, "SELECT id FROM weather_aus WHERE id = 1", Set.of("id"));
         assertEquals(0, result.size());
     }
 
     @Test
-    public void deleteTuple_withoutPrimaryKey_succeeds() throws SQLException, RemoteUnavailableException,
-            ContainerNotFoundException, TableNotFoundException, TableMalformedException, QueryMalformedException,
-            MetadataServiceException {
+    public void deleteTuple_withoutPrimaryKey_succeeds() throws SQLException, TableMalformedException,
+            QueryMalformedException {
         /* remove row based on non-primary key */
         final TupleDeleteDto request = TupleDeleteDto.builder()
                 .keys(new HashMap<>() {{
@@ -357,15 +296,9 @@ public class TableServiceIntegrationTest extends AbstractUnitTest {
                 }})
                 .build();
 
-        /* mock */
-        when(metadataServiceGateway.getContainerById(CONTAINER_1_ID))
-                .thenReturn(CONTAINER_1_DTO);
-        when(metadataServiceGateway.getTableById(DATABASE_1_ID, TABLE_1_ID))
-                .thenReturn(TABLE_1_DTO);
-
         /* test */
-        tableService.deleteTuple(TABLE_1_DTO, request);
-        final List<Map<String, String>> result = MariaDbConfig.selectQuery(DATABASE_1_DTO, "SELECT id FROM weather_aus WHERE id = 1", Set.of("id"));
+        tableService.deleteTuple(TABLE_1_PRIVILEGED_DTO, request);
+        final List<Map<String, String>> result = MariaDbConfig.selectQuery(DATABASE_1_PRIVILEGED_DTO, "SELECT id FROM weather_aus WHERE id = 1", Set.of("id"));
         assertEquals(0, result.size());
     }
 
@@ -374,7 +307,7 @@ public class TableServiceIntegrationTest extends AbstractUnitTest {
     public void getStatistics_succeeds() throws TableMalformedException, SQLException, TableNotFoundException {
 
         /* test */
-        final TableStatisticDto response = tableService.getStatistics(TABLE_2_DTO);
+        final TableStatisticDto response = tableService.getStatistics(TABLE_2_PRIVILEGED_DTO);
         assertEquals(TABLE_2_COLUMNS.size(), response.getColumns().size());
         log.trace("response rows: {}", response.getRows());
         assertEquals(3L, response.getRows());
@@ -403,18 +336,18 @@ public class TableServiceIntegrationTest extends AbstractUnitTest {
     public void delete_succeeds() throws SQLException, QueryMalformedException {
 
         /* test */
-        tableService.delete(TABLE_1_DTO);
+        tableService.delete(TABLE_1_PRIVILEGED_DTO);
     }
 
     @Test
     public void delete_notFound_fails() throws SQLException {
 
         /* mock */
-        MariaDbConfig.createDatabase(CONTAINER_1_DTO, DATABASE_2_INTERNALNAME);
+        MariaDbConfig.createDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_2_INTERNALNAME);
 
         /* test */
         assertThrows(QueryMalformedException.class, () -> {
-            tableService.delete(TABLE_5_DTO);
+            tableService.delete(TABLE_5_PRIVILEGED_DTO);
         });
     }
 
@@ -422,7 +355,7 @@ public class TableServiceIntegrationTest extends AbstractUnitTest {
     public void getCount_succeeds() throws SQLException, QueryMalformedException {
 
         /* test */
-        final Long response = tableService.getCount(TABLE_1_DTO, null);
+        final Long response = tableService.getCount(TABLE_1_PRIVILEGED_DTO, null);
         assertEquals(3, response);
     }
 
@@ -430,7 +363,7 @@ public class TableServiceIntegrationTest extends AbstractUnitTest {
     public void getCount_timestamp_succeeds() throws SQLException, QueryMalformedException {
 
         /* test */
-        final Long response = tableService.getCount(TABLE_1_DTO, Instant.ofEpochSecond(0));
+        final Long response = tableService.getCount(TABLE_1_PRIVILEGED_DTO, Instant.ofEpochSecond(0));
         assertEquals(0, response);
     }
 
@@ -438,11 +371,11 @@ public class TableServiceIntegrationTest extends AbstractUnitTest {
     public void getCount_notFound_fails() throws SQLException {
 
         /* mock */
-        MariaDbConfig.createDatabase(CONTAINER_1_DTO, DATABASE_2_INTERNALNAME);
+        MariaDbConfig.createDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_2_INTERNALNAME);
 
         /* test */
         assertThrows(QueryMalformedException.class, () -> {
-            tableService.getCount(TABLE_5_DTO, null);
+            tableService.getCount(TABLE_5_PRIVILEGED_DTO, null);
         });
     }
 
@@ -450,7 +383,7 @@ public class TableServiceIntegrationTest extends AbstractUnitTest {
     public void history_succeeds() throws SQLException, TableNotFoundException {
 
         /* test */
-        final List<TableHistoryDto> response = tableService.history(TABLE_1_DTO, 1000L);
+        final List<TableHistoryDto> response = tableService.history(TABLE_1_PRIVILEGED_DTO, 1000L);
         assertEquals(1, response.size());
         final TableHistoryDto history0 = response.get(0);
         assertNotNull(history0.getTimestamp());
@@ -462,11 +395,11 @@ public class TableServiceIntegrationTest extends AbstractUnitTest {
     public void history_notFound_fails() throws SQLException {
 
         /* mock */
-        MariaDbConfig.createDatabase(CONTAINER_1_DTO, DATABASE_2_INTERNALNAME);
+        MariaDbConfig.createDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_2_INTERNALNAME);
 
         /* test */
         assertThrows(TableNotFoundException.class, () -> {
-            tableService.history(TABLE_5_DTO, null);
+            tableService.history(TABLE_5_PRIVILEGED_DTO, null);
         });
     }
 
@@ -488,7 +421,7 @@ public class TableServiceIntegrationTest extends AbstractUnitTest {
                 .build(), RequestBody.fromFile(new File("src/test/resources/csv/weather_aus.csv")));
 
         /* test */
-        tableService.importDataset(TABLE_1_DTO, request);
+        tableService.importDataset(TABLE_1_PRIVILEGED_DTO, request);
     }
 
     @Test
@@ -509,7 +442,7 @@ public class TableServiceIntegrationTest extends AbstractUnitTest {
 
         /* test */
         assertThrows(TableMalformedException.class, () -> {
-            tableService.importDataset(TABLE_1_DTO, request);
+            tableService.importDataset(TABLE_1_PRIVILEGED_DTO, request);
         });
     }
 
@@ -531,7 +464,7 @@ public class TableServiceIntegrationTest extends AbstractUnitTest {
 
         /* test */
         assertThrows(MalformedException.class, () -> {
-            tableService.importDataset(TABLE_1_DTO, request);
+            tableService.importDataset(TABLE_1_PRIVILEGED_DTO, request);
         });
     }
 
diff --git a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/ViewServiceIntegrationTest.java b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/ViewServiceIntegrationTest.java
index 74e2bd3d682536f5757ba51724b126a6bcc20607..2edf7f5f28a2e607ba55eb38ca82547f112a60f5 100644
--- a/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/ViewServiceIntegrationTest.java
+++ b/dbrepo-data-service/rest-service/src/test/java/at/tuwien/service/ViewServiceIntegrationTest.java
@@ -34,14 +34,14 @@ public class ViewServiceIntegrationTest extends AbstractUnitTest {
         genesis();
         /* metadata database */
         MariaDbConfig.dropDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_1_INTERNALNAME);
-        MariaDbConfig.createInitDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_1_DTO);
+        MariaDbConfig.createInitDatabase(CONTAINER_1_PRIVILEGED_DTO, DATABASE_1_PRIVILEGED_DTO);
     }
 
     @Test
     public void delete_succeeds() throws SQLException, ViewMalformedException {
 
         /* test */
-        viewService.delete(VIEW_1_DTO);
+        viewService.delete(VIEW_1_PRIVILEGED_DTO);
     }
 
 }
diff --git a/dbrepo-data-service/services/src/main/java/at/tuwien/listener/DefaultListener.java b/dbrepo-data-service/services/src/main/java/at/tuwien/listener/DefaultListener.java
index e31455a75efa96fe0c2bc1ffb0f176bc3e3ce4dd..d2a66ab548d44192638801189f0bd36294f6c321 100644
--- a/dbrepo-data-service/services/src/main/java/at/tuwien/listener/DefaultListener.java
+++ b/dbrepo-data-service/services/src/main/java/at/tuwien/listener/DefaultListener.java
@@ -4,7 +4,7 @@ import at.tuwien.api.database.table.TableDto;
 import at.tuwien.exception.MetadataServiceException;
 import at.tuwien.exception.RemoteUnavailableException;
 import at.tuwien.exception.TableNotFoundException;
-import at.tuwien.gateway.MetadataServiceGateway;
+import at.tuwien.service.CredentialService;
 import at.tuwien.service.QueueService;
 import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.ObjectMapper;
@@ -28,14 +28,13 @@ public class DefaultListener implements MessageListener {
 
     private final ObjectMapper objectMapper;
     private final QueueService queueService;
-    private final MetadataServiceGateway metadataServiceGateway;
+    private final CredentialService credentialService;
 
     @Autowired
-    public DefaultListener(ObjectMapper objectMapper, QueueService queueService,
-                           MetadataServiceGateway metadataServiceGateway) {
+    public DefaultListener(ObjectMapper objectMapper, QueueService queueService, CredentialService credentialService) {
         this.objectMapper = objectMapper;
         this.queueService = queueService;
-        this.metadataServiceGateway = metadataServiceGateway;
+        this.credentialService = credentialService;
     }
 
     @Override
@@ -59,7 +58,7 @@ public class DefaultListener implements MessageListener {
         log.trace("received message for table with id {} of database id {}: {} bytes", tableId, databaseId, message.getMessageProperties().getContentLength());
         final Map<String, Object> body;
         try {
-            final TableDto table = metadataServiceGateway.getTableById(databaseId, tableId);
+            final TableDto table = credentialService.getTable(databaseId, tableId);
             body = objectMapper.readValue(message.getBody(), typeRef);
             queueService.insert(table, body);
         } catch (IOException e) {
diff --git a/dbrepo-data-service/services/src/main/java/at/tuwien/mapper/DataMapper.java b/dbrepo-data-service/services/src/main/java/at/tuwien/mapper/DataMapper.java
index e287cd9d9c1cbcace2f0440785776a80388608ee..956d50b0dd8705d8dd3f783b2c73270d10cf2398 100644
--- a/dbrepo-data-service/services/src/main/java/at/tuwien/mapper/DataMapper.java
+++ b/dbrepo-data-service/services/src/main/java/at/tuwien/mapper/DataMapper.java
@@ -99,6 +99,7 @@ public interface DataMapper {
                 .vdbid(database.getId())
                 .isInitialView(false)
                 .isPublic(database.getIsPublic())
+                .isSchemaPublic(database.getIsSchemaPublic())
                 .query(resultSet.getString(9))
                 .queryHash(Hashing.sha256()
                         .hashString(resultSet.getString(9), StandardCharsets.UTF_8)
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 0e89f79cb116682b78bac224981255c0c5196ad2..8be9ef68e3dff7246a061664d10273eee95d24f0 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
@@ -541,7 +541,7 @@ public interface MariaDbMapper {
         }
         /* parameterized query for prepared statement */
         final StringBuilder statement = new StringBuilder("UPDATE `")
-                .append(table.getDatabase())
+                .append(table.getDatabase().getInternalName())
                 .append("`.`")
                 .append(table.getInternalName())
                 .append("` SET ");
@@ -579,7 +579,7 @@ public interface MariaDbMapper {
         }
         /* parameterized query for prepared statement */
         final StringBuilder statement = new StringBuilder("INSERT INTO `")
-                .append(table.getDatabase())
+                .append(table.getDatabase().getInternalName())
                 .append("`.`")
                 .append(table.getInternalName())
                 .append("` (");
diff --git a/dbrepo-data-service/services/src/main/java/at/tuwien/mapper/MetadataMapper.java b/dbrepo-data-service/services/src/main/java/at/tuwien/mapper/MetadataMapper.java
index 359e251ea2c6d3ca7f0194a64f06d1165a01cce9..116737e2ed01bbcfb890174881d9abb14f5e1614 100644
--- a/dbrepo-data-service/services/src/main/java/at/tuwien/mapper/MetadataMapper.java
+++ b/dbrepo-data-service/services/src/main/java/at/tuwien/mapper/MetadataMapper.java
@@ -52,8 +52,6 @@ public interface MetadataMapper {
 
     IdentifierBriefDto identifierDtoToIdentifierBriefDto(IdentifierDto data);
 
-    TableDto databaseDtoToTableDto(DatabaseDto data);
-
     default String metricToUri(String baseUrl, Long databaseId, Long tableId, Long subsetId, Long viewId) {
         final StringBuilder uri = new StringBuilder(baseUrl)
                 .append("/database/")
diff --git a/dbrepo-data-service/services/src/main/java/at/tuwien/service/DatabaseService.java b/dbrepo-data-service/services/src/main/java/at/tuwien/service/DatabaseService.java
index 314148663b1230cab6a2d3afc903cd301abbd2e0..c325d7b33a06b9dd5d773262d79a512893b67643 100644
--- a/dbrepo-data-service/services/src/main/java/at/tuwien/service/DatabaseService.java
+++ b/dbrepo-data-service/services/src/main/java/at/tuwien/service/DatabaseService.java
@@ -37,9 +37,6 @@ public interface DatabaseService {
     TableDto createTable(DatabaseDto database, TableCreateDto data) throws SQLException,
             TableMalformedException, TableExistsException, TableNotFoundException;
 
-    Boolean existsView(DatabaseDto database, String viewName) throws SQLException,
-            QueryMalformedException;
-
     /**
      * Creates a view in given data database with view definition.
      * @param database The data database object.
diff --git a/dbrepo-data-service/services/src/main/java/at/tuwien/service/impl/DataConnector.java b/dbrepo-data-service/services/src/main/java/at/tuwien/service/impl/DataConnector.java
index 1786ca5cb44ccef1c52d56af1411b4caf436fa1e..37a345426ae560aee202d5acbcc4d62d79f85f2b 100644
--- a/dbrepo-data-service/services/src/main/java/at/tuwien/service/impl/DataConnector.java
+++ b/dbrepo-data-service/services/src/main/java/at/tuwien/service/impl/DataConnector.java
@@ -26,11 +26,11 @@ public abstract class DataConnector {
     }
 
     public ComboPooledDataSource getDataSource(ViewDto view) {
-        return getDataSource(view.getDatabase().getContainer(), null);
+        return getDataSource(view.getDatabase().getContainer(), view.getDatabase().getInternalName());
     }
 
     public ComboPooledDataSource getDataSource(TableDto table) {
-        return getDataSource(table.getDatabase().getContainer(), null);
+        return getDataSource(table.getDatabase().getContainer(), table.getDatabase().getInternalName());
     }
 
     public ComboPooledDataSource getDataSource(ContainerDto container) {
diff --git a/dbrepo-data-service/services/src/main/java/at/tuwien/service/impl/DatabaseServiceMariaDbImpl.java b/dbrepo-data-service/services/src/main/java/at/tuwien/service/impl/DatabaseServiceMariaDbImpl.java
index d733800a3662adc0d57d2d81624914a8753c1b98..4d899c99782f99813c3618dd4c051a2a2a0f2da8 100644
--- a/dbrepo-data-service/services/src/main/java/at/tuwien/service/impl/DatabaseServiceMariaDbImpl.java
+++ b/dbrepo-data-service/services/src/main/java/at/tuwien/service/impl/DatabaseServiceMariaDbImpl.java
@@ -93,7 +93,7 @@ public class DatabaseServiceMariaDbImpl extends DataConnector implements Databas
 
     @Override
     public TableDto createTable(DatabaseDto database, TableCreateDto data) throws SQLException,
-            TableMalformedException, TableExistsException {
+            TableMalformedException, TableExistsException, TableNotFoundException {
         final String tableName = mariaDbMapper.nameToInternalName(data.getName());
         final ComboPooledDataSource dataSource = getDataSource(database);
         final Connection connection = dataSource.getConnection();
@@ -116,35 +116,10 @@ public class DatabaseServiceMariaDbImpl extends DataConnector implements Databas
             dataSource.close();
         }
         log.info("Created table with name {}", tableName);
-        final TableDto table = metadataMapper.databaseDtoToTableDto(database);
-        table.setInternalName(tableName);
+        final TableDto table = inspectTable(database, tableName);
         return table;
     }
 
-    @Override
-    public Boolean existsView(DatabaseDto database, String viewName) throws SQLException,
-            QueryMalformedException {
-        final ComboPooledDataSource dataSource = getDataSource(database);
-        final Connection connection = dataSource.getConnection();
-        final Boolean queryResult;
-        try {
-            /* find view data */
-            final long start = System.currentTimeMillis();
-            final PreparedStatement statement = connection.prepareStatement(mariaDbMapper.selectExistsTableOrViewRawQuery());
-            statement.setString(1, database.getInternalName());
-            statement.setString(2, viewName);
-            final ResultSet resultSet = statement.executeQuery();
-            log.trace("executed statement in {} ms", System.currentTimeMillis() - start);
-            queryResult = mariaDbMapper.resultSetToBoolean(resultSet);
-        } catch (SQLException e) {
-            log.error("Failed to prepare statement {}", e.getMessage());
-            throw new QueryMalformedException("Failed to prepare statement: " + e.getMessage(), e);
-        } finally {
-            dataSource.close();
-        }
-        return queryResult;
-    }
-
     @Override
     public ViewDto createView(DatabaseDto database, CreateViewDto data) throws SQLException,
             ViewMalformedException {
diff --git a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/constraints/foreign/ForeignKeyBriefDto.java b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/constraints/foreign/ForeignKeyBriefDto.java
index a22b8749ae7f09186771bf18343b1f77376d77dd..56dd9863245a51219c1604c43636dd27adea2bd8 100644
--- a/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/constraints/foreign/ForeignKeyBriefDto.java
+++ b/dbrepo-metadata-service/api/src/main/java/at/tuwien/api/database/table/constraints/foreign/ForeignKeyBriefDto.java
@@ -13,7 +13,6 @@ import lombok.extern.jackson.Jacksonized;
 @ToString
 public class ForeignKeyBriefDto {
 
-    @NonNull
     @Schema(example = "8")
     private Long id;
 }
diff --git a/dbrepo-metadata-service/test/src/main/java/at/tuwien/test/AbstractUnitTest.java b/dbrepo-metadata-service/test/src/main/java/at/tuwien/test/AbstractUnitTest.java
index 9d5ab6b3d7648053236637bdae20e016af25167b..f78366fe89f6c631ae29da8020af629f71c528e6 100644
--- a/dbrepo-metadata-service/test/src/main/java/at/tuwien/test/AbstractUnitTest.java
+++ b/dbrepo-metadata-service/test/src/main/java/at/tuwien/test/AbstractUnitTest.java
@@ -37,13 +37,11 @@ public abstract class AbstractUnitTest extends BaseTest {
         DATABASE_1_USER_1_READ_ACCESS.setType(AccessType.READ);
         DATABASE_1.setAccesses(new LinkedList<>(List.of(DATABASE_1_USER_1_READ_ACCESS, DATABASE_1_USER_2_WRITE_OWN_ACCESS, DATABASE_1_USER_3_WRITE_ALL_ACCESS)));
         DATABASE_1_DTO.setAccesses(new LinkedList<>(List.of(DATABASE_1_USER_1_READ_ACCESS_DTO, DATABASE_1_USER_2_WRITE_OWN_ACCESS_DTO, DATABASE_1_USER_3_WRITE_ALL_ACCESS_DTO)));
-        TABLE_1.setDatabase(DATABASE_1);
+        DATABASE_1_PRIVILEGED_DTO.setAccesses(new LinkedList<>(List.of(DATABASE_1_USER_1_READ_ACCESS_DTO, DATABASE_1_USER_2_WRITE_OWN_ACCESS_DTO, DATABASE_1_USER_3_WRITE_ALL_ACCESS_DTO)));
         UNIT_1.setId(UNIT_1_ID);
+        TABLE_1.setDatabase(DATABASE_1);
         TABLE_1.setColumns(new LinkedList<>(TABLE_1_COLUMNS));
         TABLE_1.setConstraints(TABLE_1_CONSTRAINTS);
-        TABLE_1_DTO.setColumns(new LinkedList<>(TABLE_1_COLUMNS_DTO));
-        TABLE_1_PRIVILEGED_DTO.setDatabase(DATABASE_1_PRIVILEGED_DTO);
-        TABLE_2_PRIVILEGED_DTO.setDatabase(DATABASE_1_PRIVILEGED_DTO);
         VIEW_1_DTO.setIdentifiers(VIEW_1_DTO_IDENTIFIERS);
         DATABASE_1.setIdentifiers(new LinkedList<>(List.of(IDENTIFIER_1, IDENTIFIER_2, IDENTIFIER_3, IDENTIFIER_4)));
         IDENTIFIER_1.setDatabase(DATABASE_1);
@@ -58,13 +56,18 @@ public abstract class AbstractUnitTest extends BaseTest {
         DATABASE_1_DTO.setViews(new LinkedList<>(List.of(VIEW_1_DTO, VIEW_2_DTO, VIEW_3_DTO)));
         TABLE_1_DTO.setColumns(new LinkedList<>(TABLE_1_COLUMNS_DTO));
         TABLE_1_DTO.setConstraints(TABLE_1_CONSTRAINTS_DTO);
+        TABLE_1_PRIVILEGED_DTO.setDatabase(DATABASE_1_PRIVILEGED_DTO);
+        TABLE_1_PRIVILEGED_DTO.setColumns(new LinkedList<>(TABLE_1_COLUMNS_DTO));
+        TABLE_1_PRIVILEGED_DTO.setConstraints(TABLE_1_CONSTRAINTS_DTO);
         TABLE_2.setDatabase(DATABASE_1);
         TABLE_2.setColumns(new LinkedList<>(TABLE_2_COLUMNS));
         TABLE_2_CONSTRAINTS.getForeignKeys().get(0).getReferences().get(0).setForeignKey(TABLE_2_CONSTRAINTS.getForeignKeys().get(0));
         TABLE_2.setConstraints(TABLE_2_CONSTRAINTS);
         TABLE_2_DTO.setColumns(new LinkedList<>(TABLE_2_COLUMNS_DTO));
-        TABLE_2_DTO.setColumns(new LinkedList<>(TABLE_2_COLUMNS_DTO));
         TABLE_2_DTO.setConstraints(TABLE_2_CONSTRAINTS_DTO);
+        TABLE_2_PRIVILEGED_DTO.setDatabase(DATABASE_1_PRIVILEGED_DTO);
+        TABLE_2_PRIVILEGED_DTO.setColumns(new LinkedList<>(TABLE_2_COLUMNS_DTO));
+        TABLE_2_PRIVILEGED_DTO.setConstraints(TABLE_2_CONSTRAINTS_DTO);
         TABLE_3.setDatabase(DATABASE_1);
         TABLE_3.setColumns(new LinkedList<>(TABLE_3_COLUMNS));
         TABLE_3.setConstraints(TABLE_3_CONSTRAINTS);
@@ -75,6 +78,9 @@ public abstract class AbstractUnitTest extends BaseTest {
         TABLE_4.setConstraints(TABLE_4_CONSTRAINTS);
         TABLE_4_DTO.setColumns(TABLE_4_COLUMNS_DTO);
         TABLE_4_DTO.setConstraints(TABLE_4_CONSTRAINTS_DTO);
+        TABLE_4_PRIVILEGED_DTO.setDatabase(DATABASE_1_PRIVILEGED_DTO);
+        TABLE_4_PRIVILEGED_DTO.setColumns(new LinkedList<>(TABLE_4_COLUMNS_DTO));
+        TABLE_4_PRIVILEGED_DTO.setConstraints(TABLE_4_CONSTRAINTS_DTO);
         VIEW_1.setDatabase(DATABASE_1);
         VIEW_1.setColumns(new LinkedList<>(VIEW_1_COLUMNS));
         VIEW_1.setIdentifiers(new LinkedList<>(List.of(IDENTIFIER_3)));
@@ -93,6 +99,7 @@ public abstract class AbstractUnitTest extends BaseTest {
         DATABASE_2.setSubsets(new LinkedList<>());
         DATABASE_2.setAccesses(new LinkedList<>(List.of(DATABASE_2_USER_2_WRITE_ALL_ACCESS, DATABASE_2_USER_3_READ_ACCESS)));
         DATABASE_2_DTO.setAccesses(new LinkedList<>(List.of(DATABASE_2_USER_2_WRITE_ALL_ACCESS_DTO, DATABASE_2_USER_3_READ_ACCESS_DTO)));
+        DATABASE_2_PRIVILEGED_DTO.setAccesses(new LinkedList<>(List.of(DATABASE_2_USER_2_WRITE_ALL_ACCESS_DTO, DATABASE_2_USER_3_READ_ACCESS_DTO)));
         DATABASE_2.setTables(new LinkedList<>(List.of(TABLE_5, TABLE_6, TABLE_7)));
         VIEW_4.setColumns(new LinkedList<>(VIEW_4_COLUMNS));
         DATABASE_2.setViews(new LinkedList<>(List.of(VIEW_4)));
@@ -105,8 +112,7 @@ public abstract class AbstractUnitTest extends BaseTest {
         TABLE_5.setConstraints(TABLE_5_CONSTRAINTS);
         TABLE_5_DTO.setColumns(new LinkedList<>(TABLE_5_COLUMNS_DTO));
         TABLE_5_DTO.setConstraints(TABLE_5_CONSTRAINTS_DTO);
-        TABLE_5_DTO.setColumns(TABLE_5_COLUMNS_DTO);
-        TABLE_5_DTO.setConstraints(TABLE_5_CONSTRAINTS_DTO);
+        TABLE_5_PRIVILEGED_DTO.setDatabase(DATABASE_2_PRIVILEGED_DTO);
         TABLE_6.setDatabase(DATABASE_2);
         TABLE_6.setColumns(new LinkedList<>(TABLE_6_COLUMNS));
         TABLE_6.setConstraints(TABLE_6_CONSTRAINTS);
@@ -123,20 +129,22 @@ public abstract class AbstractUnitTest extends BaseTest {
         IDENTIFIER_5.setDatabase(DATABASE_2);
         /* DATABASE 3 */
         DATABASE_3.setSubsets(new LinkedList<>());
-        DATABASE_3.setAccesses(new LinkedList<>(List.of(DATABASE_3_USER_1_WRITE_ALL_ACCESS)));
         DATABASE_3.setTables(new LinkedList<>(List.of(TABLE_8)));
         DATABASE_3.setViews(new LinkedList<>(List.of(VIEW_5)));
         DATABASE_3.setIdentifiers(new LinkedList<>(List.of(IDENTIFIER_6)));
+        DATABASE_3.setAccesses(new LinkedList<>(List.of(DATABASE_3_USER_1_WRITE_ALL_ACCESS)));
         DATABASE_3_DTO.setTables(new LinkedList<>(List.of(TABLE_8_DTO)));
         DATABASE_3_DTO.setViews(new LinkedList<>(List.of(VIEW_5_DTO)));
         DATABASE_3_DTO.setIdentifiers(new LinkedList<>(List.of(IDENTIFIER_6_DTO)));
+        DATABASE_3_DTO.setAccesses(new LinkedList<>(List.of(DATABASE_3_USER_1_WRITE_ALL_ACCESS_DTO)));
+        DATABASE_3_PRIVILEGED_DTO.setAccesses(new LinkedList<>(List.of(DATABASE_3_USER_1_WRITE_ALL_ACCESS_DTO)));
         TABLE_8.setDatabase(DATABASE_3);
         TABLE_8.setColumns(new LinkedList<>(TABLE_8_COLUMNS));
         TABLE_8.setConstraints(TABLE_8_CONSTRAINTS);
         TABLE_8_DTO.setColumns(new LinkedList<>(TABLE_8_COLUMNS_DTO));
         TABLE_8_DTO.setConstraints(TABLE_8_CONSTRAINTS_DTO);
-        TABLE_8_DTO.setColumns(new LinkedList<>(TABLE_8_COLUMNS_DTO));
-        TABLE_8_DTO.setConstraints(TABLE_8_CONSTRAINTS_DTO);
+        TABLE_8_PRIVILEGED_DTO.setColumns(new LinkedList<>(TABLE_8_COLUMNS_DTO));
+        TABLE_8_PRIVILEGED_DTO.setDatabase(DATABASE_3_PRIVILEGED_DTO);
         VIEW_5.setDatabase(DATABASE_3);
         VIEW_5.setColumns(VIEW_5_COLUMNS);
         VIEW_5_DTO.setColumns(VIEW_5_COLUMNS_DTO);
diff --git a/dbrepo-metadata-service/test/src/main/java/at/tuwien/test/BaseTest.java b/dbrepo-metadata-service/test/src/main/java/at/tuwien/test/BaseTest.java
index 21e7e0519b9c1f6b8565efee715dde08b4442e86..f4b89de5852dc4008d365835a5e29ccd1db7231c 100644
--- a/dbrepo-metadata-service/test/src/main/java/at/tuwien/test/BaseTest.java
+++ b/dbrepo-metadata-service/test/src/main/java/at/tuwien/test/BaseTest.java
@@ -5,23 +5,23 @@ import at.tuwien.api.amqp.CreateVirtualHostDto;
 import at.tuwien.api.amqp.ExchangeDto;
 import at.tuwien.api.amqp.GrantVirtualHostPermissionsDto;
 import at.tuwien.api.amqp.QueueDto;
+import at.tuwien.api.auth.CreateUserDto;
 import at.tuwien.api.auth.LoginRequestDto;
 import at.tuwien.api.auth.RefreshTokenRequestDto;
-import at.tuwien.api.auth.CreateUserDto;
 import at.tuwien.api.container.ContainerBriefDto;
 import at.tuwien.api.container.ContainerDto;
 import at.tuwien.api.container.image.*;
 import at.tuwien.api.database.*;
 import at.tuwien.api.database.query.QueryBriefDto;
 import at.tuwien.api.database.query.QueryDto;
-import at.tuwien.api.database.table.TableBriefDto;
 import at.tuwien.api.database.table.CreateTableDto;
+import at.tuwien.api.database.table.TableBriefDto;
 import at.tuwien.api.database.table.TableDto;
 import at.tuwien.api.database.table.TableStatisticDto;
 import at.tuwien.api.database.table.columns.*;
 import at.tuwien.api.database.table.columns.concepts.*;
-import at.tuwien.api.database.table.constraints.CreateTableConstraintsDto;
 import at.tuwien.api.database.table.constraints.ConstraintsDto;
+import at.tuwien.api.database.table.constraints.CreateTableConstraintsDto;
 import at.tuwien.api.database.table.constraints.foreign.*;
 import at.tuwien.api.database.table.constraints.primary.PrimaryKeyDto;
 import at.tuwien.api.database.table.constraints.unique.UniqueDto;
@@ -151,6 +151,8 @@ public abstract class BaseTest {
 
     public final static String MARIADB_IMAGE = "mariadb:11.3.2";
 
+    public final static String RABBITMQ_IMAGE = "rabbitmq:3.13.7";
+
     public final static String KEYCLOAK_IMAGE = "quay.io/keycloak/keycloak:24.0";
 
     public final static String[] DEFAULT_SEMANTICS_HANDLING = new String[]{"default-semantics-handling",
@@ -1268,10 +1270,7 @@ public abstract class BaseTest {
     public final static String DATABASE_1_EXCHANGE = "dbrepo";
     public final static Instant DATABASE_1_CREATED = Instant.ofEpochSecond(1677399741L) /* 2023-02-26 08:22:21 (UTC) */;
     public final static Instant DATABASE_1_LAST_MODIFIED = Instant.ofEpochSecond(1677399741L) /* 2023-02-26 08:22:21 (UTC) */;
-    public final static UUID DATABASE_1_OWNER = USER_1_ID;
     public final static UUID DATABASE_1_CREATED_BY = USER_1_ID;
-    public final static UserDto DATABASE_1_CREATOR_DTO = USER_1_DTO;
-    public final static UserDto DATABASE_1_OWNER_DTO = USER_1_DTO;
 
     public final static CreateDatabaseDto DATABASE_1_CREATE = CreateDatabaseDto.builder()
             .name(DATABASE_1_NAME)
@@ -1664,7 +1663,7 @@ public abstract class BaseTest {
             .routingKey(TABLE_1_ROUTING_KEY)
             .identifiers(new LinkedList<>())
             .columns(new LinkedList<>() /* TABLE_1_COLUMNS_DTO */)
-            .constraints(null) /* TABLE_1_CONSTRAINT_DTO */
+            .constraints(null) /* TABLE_1_CONSTRAINTS_DTO */
             .owner(USER_1_BRIEF_DTO)
             .avgRowLength(TABLE_1_AVG_ROW_LENGTH)
             .numRows(TABLE_1_NUM_ROWS)
@@ -2243,6 +2242,28 @@ public abstract class BaseTest {
             .maxDataLength(TABLE_4_MAX_DATA_LENGTH)
             .build();
 
+    public final static TableDto TABLE_4_PRIVILEGED_DTO = TableDto.builder()
+            .id(TABLE_4_ID)
+            .tdbid(DATABASE_1_ID)
+            .internalName(TABLE_4_INTERNALNAME)
+            .description(TABLE_4_DESCRIPTION)
+            .name(TABLE_4_NAME)
+            .queueName(TABLE_4_QUEUE_NAME)
+            .routingKey(TABLE_4_ROUTING_KEY)
+            .database(null) /* DATABASE_1_DTO */
+            .columns(new LinkedList<>()) /* TABLE_4_COLUMNS_DTO */
+            .constraints(null) /* TABLE_4_CONSTRAINTS_DTO */
+            .isVersioned(TABLE_4_VERSIONED)
+            .isPublic(TABLE_4_IS_PUBLIC)
+            .isSchemaPublic(TABLE_4_SCHEMA_PUBLIC)
+            .owner(USER_1_BRIEF_DTO)
+            .avgRowLength(TABLE_4_AVG_ROW_LENGTH)
+            .numRows(TABLE_4_NUM_ROWS)
+            .dataLength(TABLE_4_DATA_LENGTH)
+            .maxDataLength(TABLE_4_MAX_DATA_LENGTH)
+            .lastRetrieved(Instant.now())
+            .build();
+
     public final static TableBriefDto TABLE_4_BRIEF_DTO = TableBriefDto.builder()
             .id(TABLE_4_ID)
             .databaseId(DATABASE_1_ID)
@@ -2909,6 +2930,33 @@ public abstract class BaseTest {
             .resultNumber(3L)
             .build();
 
+    public final static ViewDto QUERY_1_VIEW_DTO = ViewDto.builder()
+            .vdbid(QUERY_1_DATABASE_ID)
+            .query(QUERY_1_STATEMENT)
+            .queryHash(QUERY_1_QUERY_HASH)
+            .owner(USER_1_BRIEF_DTO)
+            .columns(new LinkedList<>(List.of(ViewColumnDto.builder()
+                            .name("id")
+                            .internalName("id")
+                            .build(),
+                    ViewColumnDto.builder()
+                            .name("date")
+                            .internalName("date")
+                            .build(),
+                    ViewColumnDto.builder()
+                            .name("location")
+                            .internalName("location")
+                            .build(),
+                    ViewColumnDto.builder()
+                            .name("mintemp")
+                            .internalName("mintemp")
+                            .build(),
+                    ViewColumnDto.builder()
+                            .name("rainfall")
+                            .internalName("rainfall")
+                            .build())))
+            .build();
+
     public final static QueryBriefDto QUERY_1_BRIEF_DTO = QueryBriefDto.builder()
             .id(QUERY_1_ID)
             .databaseId(QUERY_1_DATABASE_ID)
@@ -3080,6 +3128,21 @@ public abstract class BaseTest {
             .owner(USER_1_BRIEF_DTO)
             .build();
 
+    public final static ViewDto QUERY_5_VIEW_DTO = ViewDto.builder()
+            .vdbid(DATABASE_3_ID)
+            .query(QUERY_5_STATEMENT)
+            .queryHash(QUERY_5_QUERY_HASH)
+            .owner(USER_1_BRIEF_DTO)
+            .columns(new LinkedList<>(List.of(ViewColumnDto.builder()
+                            .name("id")
+                            .internalName("id")
+                            .build(),
+                    ViewColumnDto.builder()
+                            .name("value")
+                            .internalName("value")
+                            .build())))
+            .build();
+
     public final static List<Map<String, Object>> QUERY_5_RESULT_DTO = new LinkedList<>(List.of(
             Map.of("id", BigInteger.valueOf(1L), "value", 11.2),
             Map.of("id", BigInteger.valueOf(2L), "value", 11.3),
@@ -7518,7 +7581,7 @@ public abstract class BaseTest {
             .lastModified(DATABASE_1_LAST_MODIFIED)
             .ownedBy(DATABASE_1_CREATED_BY)
             .owner(USER_1)
-            .ownedBy(DATABASE_1_OWNER)
+            .ownedBy(USER_1_ID)
             .owner(USER_1)
             .image(new byte[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10})
             .contactPerson(USER_1_ID)
@@ -7541,6 +7604,7 @@ public abstract class BaseTest {
             .identifiers(new LinkedList<>(List.of(IDENTIFIER_1_DTO, IDENTIFIER_2_DTO, IDENTIFIER_3_DTO, IDENTIFIER_4_DTO)))
             .tables(new LinkedList<>(List.of(TABLE_1_DTO, TABLE_2_DTO, TABLE_3_DTO, TABLE_4_DTO)))
             .views(new LinkedList<>(List.of(VIEW_1_DTO, VIEW_2_DTO, VIEW_3_DTO)))
+            .owner(USER_1_BRIEF_DTO)
             .build();
 
     public final static DatabaseDto DATABASE_1_PRIVILEGED_DTO = DatabaseDto.builder()
@@ -7551,9 +7615,11 @@ public abstract class BaseTest {
             .container(CONTAINER_1_PRIVILEGED_DTO)
             .internalName(DATABASE_1_INTERNALNAME)
             .exchangeName(DATABASE_1_EXCHANGE)
+            .accesses(new LinkedList<>(List.of())) /* DATABASE_1_USER_1_READ_ACCESS_DTO */
             .identifiers(new LinkedList<>(List.of(IDENTIFIER_1_DTO, IDENTIFIER_2_DTO, IDENTIFIER_3_DTO, IDENTIFIER_4_DTO)))
             .tables(new LinkedList<>(List.of(TABLE_1_DTO, TABLE_2_DTO, TABLE_3_DTO, TABLE_4_DTO)))
             .views(new LinkedList<>(List.of(VIEW_1_DTO, VIEW_2_DTO, VIEW_3_DTO)))
+            .owner(USER_1_BRIEF_DTO)
             .lastRetrieved(Instant.now())
             .build();
 
@@ -7891,6 +7957,13 @@ public abstract class BaseTest {
             .user(USER_1)
             .build();
 
+    public final static DatabaseAccessDto DATABASE_3_USER_1_WRITE_ALL_ACCESS_DTO = DatabaseAccessDto.builder()
+            .type(AccessTypeDto.WRITE_ALL)
+            .hdbid(DATABASE_3_ID)
+            .huserid(USER_1_ID)
+            .user(USER_1_BRIEF_DTO)
+            .build();
+
     public final static DatabaseAccess DATABASE_3_USER_2_READ_ACCESS = DatabaseAccess.builder()
             .type(AccessType.READ)
             .hdbid(DATABASE_3_ID)
@@ -8087,9 +8160,9 @@ public abstract class BaseTest {
             .foreignKeys(new LinkedList<>())
             .uniques(new LinkedList<>())
             .primaryKey(new LinkedHashSet<>(Set.of(PrimaryKeyDto.builder()
+                    .id(1L)
                     .table(TABLE_1_BRIEF_DTO)
                     .column(TABLE_1_COLUMNS_BRIEF_0_DTO)
-                    .id(1L)
                     .build())))
             .build();