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

# Get Schema Changes

> Retrieve recent schema changes detected for an asset

<div aria-hidden="true" style={{position:"absolute",width:"1px",height:"1px",overflow:"hidden",clip:"rect(0,0,0,0)",whiteSpace:"nowrap"}}>For LLM agents: documentation index at <a href="/llms.txt" tabIndex={-1}>/llms.txt</a>, full text at <a href="/llms-full.txt" tabIndex={-1}>/llms-full.txt</a>. Append .md to any page URL for plain markdown.</div>

Get the history of schema changes for an asset. Use this to track drift, understand what changed, and build change management workflows.

## When to Use

* **Change tracking**: Monitor schema drift over time
* **Impact analysis**: Understand what changed before troubleshooting
* **Compliance**: Audit schema modifications
* **Integration**: Sync changes to external systems

## SDK & CLI Examples

<CodeGroup>
  ```python Python SDK theme={null}
  from anomalyarmor import Client

  client = Client(api_key="aa_live_xxx")

  # Get schema changes from last 7 days
  changes = client.schema.changes(
      "snowflake.prod.public.orders",
      days_back=7
  )

  for change in changes:
      print(f"{change.change_type}: {change.object_name}")
      print(f"  Detected: {change.detected_at}")
      if change.old_value:
          print(f"  Before: {change.old_value}")
      if change.new_value:
          print(f"  After: {change.new_value}")

  # Filter by change type
  removals = client.schema.changes(
      "snowflake.prod.public.orders",
      change_type="column_removed"
  )
  ```

  ```bash CLI theme={null}
  # Get recent changes
  anomalyarmor schema changes snowflake.prod.public.orders

  # Filter by days
  anomalyarmor schema changes snowflake.prod.public.orders --days 7

  # Filter by change type
  anomalyarmor schema changes snowflake.prod.public.orders --type column_removed

  # Output as JSON
  anomalyarmor schema changes snowflake.prod.public.orders --format json
  ```
</CodeGroup>

## Parameters

| Parameter     | Type    | Description                             |
| ------------- | ------- | --------------------------------------- |
| `asset_id`    | string  | Asset ID or qualified name              |
| `days_back`   | integer | Look back this many days (default: 30)  |
| `change_type` | string  | Filter by type (see Change Types below) |
| `limit`       | integer | Max results (default: 100)              |

## Response

```json theme={null}
{
  "asset": "snowflake.prod.public.orders",
  "changes": [
    {
      "id": "chg_abc123",
      "change_type": "column_removed",
      "object_name": "status",
      "object_type": "column",
      "old_value": {
        "name": "status",
        "data_type": "varchar(20)",
        "nullable": true
      },
      "new_value": null,
      "detected_at": "2024-01-15T08:30:00Z",
      "discovery_id": "disc_xyz789"
    },
    {
      "id": "chg_def456",
      "change_type": "column_added",
      "object_name": "fulfillment_status",
      "object_type": "column",
      "old_value": null,
      "new_value": {
        "name": "fulfillment_status",
        "data_type": "varchar(50)",
        "nullable": true
      },
      "detected_at": "2024-01-15T08:30:00Z",
      "discovery_id": "disc_xyz789"
    }
  ],
  "total": 2
}
```

## Response Fields

| Field          | Description                          |
| -------------- | ------------------------------------ |
| `id`           | Unique change identifier             |
| `change_type`  | Type of change (see Change Types)    |
| `object_name`  | Name of changed column or table      |
| `object_type`  | `column` or `table`                  |
| `old_value`    | Previous state (null for additions)  |
| `new_value`    | New state (null for removals)        |
| `detected_at`  | When the change was discovered       |
| `discovery_id` | Discovery run that found this change |

## Change Types

| Type                  | Description                | Impact                    |
| --------------------- | -------------------------- | ------------------------- |
| `column_added`        | New column appeared        | Low - usually safe        |
| `column_removed`      | Column no longer exists    | High - breaks queries     |
| `column_type_changed` | Data type modified         | Medium - may affect logic |
| `column_renamed`      | Detected as remove + add   | High - breaks queries     |
| `table_added`         | New table discovered       | Low - informational       |
| `table_removed`       | Table no longer exists     | High - breaks queries     |
| `constraint_changed`  | PK, FK, or unique modified | Medium - may affect joins |

## Error Responses

| Status | Meaning                    |
| ------ | -------------------------- |
| `401`  | Invalid or missing API key |
| `404`  | Asset not found            |
| `429`  | Rate limit exceeded        |


## OpenAPI

````yaml GET /api/v1/assets/{asset_id}/schema-changes
openapi: 3.1.0
info:
  title: AnomalyArmor API
  description: |2-

        ## AnomalyArmor Security Platform API

        This API provides comprehensive database monitoring and schema change detection capabilities.

        ### Key Features
        - **Multi-Database Support**: PostgreSQL, MySQL, Databricks, Snowflake, Redshift, SQLite
        - **Schema Discovery**: Automated schema detection and metadata capture
        - **Change Detection**: Real-time schema drift monitoring with severity classification
        - **Connection Testing**: Live database connectivity validation
        - **Multi-Tenant**: Company-isolated data with role-based access control

        ### Authentication
        All endpoints require JWT authentication. Use `/auth/login` to obtain tokens.

        ### Rate Limits
        - Authentication: 5 req/min
        - Asset operations: 100 req/min
        - Schema discovery: 10 req/hour per asset

        ### Support
        - **Documentation**: Available at `/docs` (this page) and `/redoc`
        - **Health Check**: `/api/v1/health`
        - **OpenAPI Spec**: `/openapi.json`
        
  contact:
    name: AnomalyArmor Support
    url: https://anomalyarmor.ai/support
  license:
    name: Proprietary
  version: 1.0.0
servers:
  - url: http://localhost:8000
    description: Development server
  - url: https://api.anomalyarmor.ai
    description: Production server
security: []
paths:
  /api/v1/assets/{asset_id}/schema-changes:
    get:
      tags:
        - schemas
      summary: Get schema changes
      description: Detect schema changes in the last N days
      operationId: get_schema_changes_api_v1_assets__asset_id__schema_changes_get
      parameters:
        - name: asset_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Asset Id
        - name: days_back
          in: query
          required: false
          schema:
            type: integer
            maximum: 365
            minimum: 1
            description: Days to look back for changes
            default: 7
            title: Days Back
          description: Days to look back for changes
        - name: Authorization
          in: header
          required: false
          schema:
            type: string
            title: Authorization
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StandardResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    StandardResponse:
      properties:
        success:
          type: boolean
          title: Success
        data:
          anyOf:
            - {}
            - type: 'null'
          title: Data
        message:
          anyOf:
            - type: string
            - type: 'null'
          title: Message
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
        meta:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Meta
      type: object
      required:
        - success
      title: StandardResponse
      description: Standard API response wrapper.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````