> ## Documentation Index
> Fetch the complete documentation index at: https://docs.prequel.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Update model

> Update an existing model.



## OpenAPI

````yaml /generated/openapi-generated-2023-12-01.json patch /models/{model_id}
openapi: 3.1.0
info:
  title: Prequel Data Export
  description: Data Export API spec
  version: '2023-12-01'
servers:
  - url: https://api.prequel.co
    description: Cloud-hosted server (US)
  - url: https://eu-api.prequel.co
    description: Cloud-hosted server (EU)
  - url: https://{custom_host}/
    description: Cloud-prem or shared-cloud server
security:
  - ApiKeyAuth: []
paths:
  /models/{model_id}:
    patch:
      tags:
        - Models
      summary: Update model
      description: Update an existing model.
      operationId: update-model
      parameters:
        - name: model_id
          in: path
          required: true
          description: Model ID.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateModelConfigRequestDocumented'
              $schema: https://json-schema.org/draft/2020-12/schema
              $id: >-
                https://github.com/prequel-co/datafeed/internal/export/api/models/update-model-config-request
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                properties:
                  status:
                    type: string
                    const: success
                  data:
                    $ref: '#/components/schemas/ModelConfigResponseDocumented'
                    $schema: https://json-schema.org/draft/2020-12/schema
                    $id: >-
                      https://github.com/prequel-co/datafeed/internal/export/api/models/model-config-response
                  message:
                    type: string
                type: object
                required:
                  - status
                  - data
                  - message
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    UpdateModelConfigRequestDocumented:
      properties:
        model:
          $ref: '#/components/schemas/UpdateModelConfigDocumented'
        skip_model_validation:
          type: boolean
          description: >-
            Whether to skip the validation of this model against the specified
            source.
      additionalProperties: false
      type: object
    ModelConfigResponseDocumented:
      properties:
        model:
          $ref: '#/components/schemas/ModelConfigDocumented'
      additionalProperties: false
      type: object
      required:
        - model
    UpdateModelConfigDocumented:
      properties:
        description:
          type: string
          description: >-
            A brief description of the table. This is customer facing and will
            be used as the table comment in the destination.
        columns:
          items:
            $ref: '#/components/schemas/UpdateModelColumnDocumented'
          type: array
        source_id:
          type: string
          format: uuid
          description: The source ID.
        source_name:
          type: string
          description: The source name.
        source_table:
          type: string
          description: The schema qualified source table in the database.
        source_query:
          type: string
          description: The source query to use for this model.
        organization_column:
          type: string
          description: The column in the source table that links to the organization.
        is_append_only:
          type: boolean
          description: >-
            Determines if the destination write logical will optimize itself for
            append only data. See append_only docs for more detail on this
            feature and usage.
        destination_table_name:
          type: string
          description: >-
            The destination table in the database. Immutable in production
            environments.
        skip_transfer_source_validation:
          type: boolean
          description: >-
            Whether to skip validating access to the specified source when
            running transfers.
        model_validation_id_in_provider_system:
          type: string
          description: Optional override for the provider system ID.
        model_validation_start_time_epoch:
          type: string
          format: date-time
          description: Optional override for the start time.
        model_validation_end_time_epoch:
          type: string
          format: date-time
          description: Optional override for the end time.
        model_validation_tags:
          additionalProperties:
            type: string
          type: object
          description: Optional override for the tags.
      additionalProperties: false
      type: object
    ModelConfigDocumented:
      properties:
        model_name:
          type: string
          description: >-
            The name of the model. This is customer facing and will be used as
            the table name in the destination.
        description:
          type: string
          description: >-
            A brief description of the table. This is customer facing and will
            be used as the table comment in the destination.
        columns:
          items:
            $ref: '#/components/schemas/ModelColumnDocumented'
          type: array
        source_id:
          type: string
          format: uuid
          description: The source ID.
        source_table:
          type: string
          description: The schema qualified source table in the database.
        source_query:
          type: string
          description: The source query to use for this model.
        destination_table_name:
          type: string
          description: The destination table in the database.
        organization_column:
          type: string
          description: The column in the source table that links to the organization.
        skip_transfer_source_validation:
          type: boolean
          default: false
        is_append_only:
          type: boolean
          description: >-
            Determines if the destination write logical will optimize itself for
            append only data. Use of this flag with duplicate primary keys in
            the source data will cause integrity issues.
        model_validation_id_in_provider_system:
          type: string
          description: Optional override for the provider system ID.
        model_validation_start_time_epoch:
          type: string
          format: date-time
          description: Optional override for the start time.
        model_validation_end_time_epoch:
          type: string
          format: date-time
          description: Optional override for the end time.
        model_validation_tags:
          additionalProperties:
            type: string
          type: object
          description: Optional override for the tags.
      additionalProperties: false
      type: object
      required:
        - model_name
        - columns
        - source_id
    ErrorResponse:
      properties:
        status:
          type: string
          const: error
        message:
          type: string
        data:
          type: 'null'
      type: object
      required:
        - status
        - message
    UpdateModelColumnDocumented:
      properties:
        name_in_source:
          type: string
          description: The column name in the source.
        name_in_destination:
          type: string
          description: The column name in the destination.
        data_type:
          type: string
          description: The data type of the column.
        is_primary_key:
          type: boolean
          description: >-
            Whether the column is a primary key. Only mutable in staging
            environment.
        is_last_modified:
          type: boolean
          description: >-
            Indicates if the column represents the last modified date/time. Only
            mutable in staging environment.
      additionalProperties: false
      type: object
    ModelColumnDocumented:
      properties:
        name_in_source:
          type: string
          description: The column name in the source.
        name_in_destination:
          type: string
          description: The column name in the destination.
        data_type:
          type: string
          description: The data type of the column.
        is_primary_key:
          type: boolean
          description: >-
            Whether the column is a primary key. Note: all properties of the
            primary key are immutable and cannot be changed after creation.
        is_last_modified:
          type: boolean
          description: Indicates if the column represents the last modified date/time.
      additionalProperties: false
      type: object
      required:
        - name_in_source
        - name_in_destination
        - data_type
        - is_primary_key
        - is_last_modified
  responses:
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFound:
      description: Not Found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InternalServerError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````