Skip to content

Comments

Add Export/Import Data functionality for column classifications#24

Draft
Copilot wants to merge 4 commits intomasterfrom
copilot/fix-8
Draft

Add Export/Import Data functionality for column classifications#24
Copilot wants to merge 4 commits intomasterfrom
copilot/fix-8

Conversation

Copy link

Copilot AI commented Jun 5, 2025

This PR implements comprehensive export and import functionality for SQL Server column classification data, allowing users to backup, restore, and migrate their data classification configurations.

Features Added

Export Data

  • New Action: ExportData available on Database entities
  • Exports all column classification data to structured JSON format
  • Includes information types, sensitivity labels, and descriptions
  • Creates timestamped files: ClassifyData_Export_{DatabaseName}_{Timestamp}.json

Import Data

  • New Action: ImportData available on Database entities
  • Imports classification data from JSON format matching export structure
  • Validates data integrity and column existence before applying changes
  • Provides detailed success/error reporting with counts and specific error messages
  • Only applies non-empty classification values to preserve existing data

Test Export

  • New Action: TestExportData for validation and testing
  • Verifies database connectivity and column discovery without creating files
  • Useful for troubleshooting and confirming functionality

Technical Implementation

  • Added ClassificationData and ColumnClassification DTOs for structured data transfer
  • Enhanced DatabaseActions class with three new action methods
  • Updated model.json to register actions in the Vidyano UI framework
  • Comprehensive error handling and validation throughout
  • SQL injection protection using parameterized queries
  • Maintains transaction consistency and data integrity

JSON Export Format

{
  "ExportedAt": "2024-01-15T14:30:00Z",
  "DatabaseName": "SampleDatabase",
  "Columns": [
    {
      "Schema": "dbo",
      "Table": "Users", 
      "Column": "Email",
      "Type": "varchar",
      "InformationTypeId": "5C503E21-22C6-81FA-620B-F369B8EC38D1",
      "InformationTypeName": "Contact Info",
      "SensitivityLabelId": "684a0db2-d514-49d8-8c0c-df84a7b083eb",
      "SensitivityLabelName": "General",
      "Description": "User email address"
    }
  ]
}

Documentation

  • Added comprehensive EXPORT_IMPORT.md with usage instructions and technical details
  • Included sample JSON export file demonstrating the data format
  • Updated main README.md to highlight the new functionality
  • Provided JSON schema documentation and usage examples

Use Cases

  • Backup/Restore: Export classifications before major schema changes
  • Environment Migration: Move classifications from dev to production
  • Bulk Operations: Apply consistent classifications across multiple databases
  • Compliance Reporting: Generate structured reports of data classification status
  • Integration: Provide data for external classification management systems

Safety Features

  • Validates column existence before applying classifications
  • Skips columns with empty/null classification values
  • Provides detailed error reporting for failed operations
  • Maintains existing data integrity during import operations
  • Uses parameterized SQL queries to prevent injection attacks

The implementation follows existing code patterns and integrates seamlessly with the current Vidyano-based application architecture while providing robust new capabilities for classification data management.

Fixes #8.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits June 5, 2025 22:04
Co-authored-by: stevehansen <2143488+stevehansen@users.noreply.github.com>
… testing

Co-authored-by: stevehansen <2143488+stevehansen@users.noreply.github.com>
Co-authored-by: stevehansen <2143488+stevehansen@users.noreply.github.com>
Copilot AI changed the title [WIP] Export/Import data Add Export/Import Data functionality for column classifications Jun 5, 2025
Copilot AI requested a review from stevehansen June 5, 2025 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Export/Import data

2 participants