---
title: "Scan a database to get a physical data model (PDM)"
method: POST
path: "/api/v1/actions/dataSources/{dataSourceId}/scan"
tags: ["Scanning"]
---

# Scan a database to get a physical data model (PDM)

`POST /api/v1/actions/dataSources/{dataSourceId}/scan`

## Request

- Base URL: `https://www.gooddata.ai`
- URL: `https://www.gooddata.ai/api/v1/actions/dataSources/{dataSourceId}/scan`
- Auth: none declared

It scans a database and transforms its metadata to a declarative definition of the physical data model (PDM). The result of the request contains the mentioned physical data model (PDM) of a database within warning, for example, about unsupported columns.

## Path parameters

- `dataSourceId` string, required

## Request body

- ScanRequest: A request containing all information critical to model scanning.
  - `scanTables` boolean, required: A flag indicating whether the tables should be scanned.
  - `scanViews` boolean, required: A flag indicating whether the views should be scanned.
  - `schemata` string[]: What schemata will be scanned.
  - `separator` string, required: A separator between prefixes and the names.
  - `tablePrefix` string: Tables starting with this prefix will be scanned. The prefix is then followed by the value of `separator` parameter. Given the table prefix is `out_table` and separator is `__`, the table with name like `out_table__customers` will be scanned.
  - `viewPrefix` string: Views starting with this prefix will be scanned. The prefix is then followed by the value of `separator` parameter. Given the view prefix is `out_view` and separator is `__`, the table with name like `out_view__us_customers` will be scanned.

## Response `200`

The result of the scan.

- ScanResultPdm: Result of scan of data source physical model.
  - `pdm` DeclarativeTables, required: A physical data model (PDM) tables.
    - `tables` DeclarativeTable[], required: An array of physical database tables.
      - `columns` DeclarativeColumn[], required: An array of physical columns
        - `dataType` 'INT' | 'STRING' | 'DATE' | 'NUMERIC' | 'TIMESTAMP' | 'TIMESTAMP_TZ' | 'BOOLEAN' | 'HLL', required: Column type
        - `defaultLabelOf` string: (EXPERIMENTAL) Name of the column whose values this column labels. Logical model generation makes this column the default label of the attribute on that column, sorted by that column.
        - `description` string: Column description/comment from database
        - `isNullable` boolean: Column is nullable
        - `isPrimaryKey` boolean: Is column part of primary key?
        - `name` string, required: Column name. Must not contain NUL (0x00) characters.
        - `nullValue` string: Value used as sentinel for nullable columns
        - `referencedTableColumn` string: Referenced table (Foreign key)
        - `referencedTableId` string: Referenced table (Foreign key)
      - `id` string, required: Table id.
      - `namePrefix` string: Table or view name prefix used in scan. Will be stripped when generating LDM.
      - `path` string[], required: Path to table.
      - `properties` object: Additional properties of the table that the data source passes on to the modeler and other callers. The data source decides which keys it sends. A caller uses the keys it understands and skips all other keys.
      - `type` string, required: Table type: TABLE or VIEW.
  - `warnings` TableWarning[], required
    - `columns` ColumnWarning[], required
      - `message` string, required: Warning message related to the column.
      - `name` string, required: Column name.
    - `message` string: Warning message related to the table.
    - `name` string, required: Table name.

---

[API](https://skmtc.dev/gooddata/apis/gooddata-cn-oapi-all-api.md) - [All operations](https://skmtc.dev/gooddata/apis/gooddata-cn-oapi-all-api/llms.txt) - [OpenAPI document](https://skmtc.dev/gooddata/apis/gooddata-cn-oapi-all-api/revisions/c728ef303bfb?raw)
