Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Latest commit

 

History

History
38 lines (29 loc) · 3.06 KB

architecture_guide.md

File metadata and controls

38 lines (29 loc) · 3.06 KB

mssql-scripter Architecture

The three core components of mssql-scripter are:

  • Python Client
  • Scripting Service
  • SqlScriptPublishModel

Python Client

The Python client is script that orchestrates the scripting operation. It's responsible for:

  • Parsing the command line options
  • Starting the SqlToolsService process
  • Issuing the scripting request to the Scripting Service
  • Responding to the Scripting Service events which report progress and completion
  • Piping the script results to STDIO

Scripting Service

The Scripter Service is hosted by the SqlToolsService, which is itself a self-contained .NET Core console application. The Scripting Service is responsible for:

  • Exposing the JSON-RPC endpoint to handle scripting requests
  • Instantiating the SqlScriptPublishModel to execute a scripting request
  • Forwarding events from the SqlScriptPublishModel to clients over JSON-RPC

NOTE

The SqlToolsService is used by other cross platform SQL tools, such as the Microsoft/vscode-mssql extension. The SqlToolsService is an open source project and hosted on github at Microsoft/sqltoolsservice.

SqlScriptPublishModel

The SqlScriptPublishModel is the component used by the Scripting Service to drive the scripting operation. It uses the SQL Server Management Objects (SMO) framework, to generate the underlying scripts for database. It's responsible for:

  • Running the scripting operations using SMO
  • Send progress events as the scripting operation makes progress

SQL Server Management Objects (SMO)

The SQL Server Management Objects library is designed for programmatic management of SQL Server. One of the many features it provides is scripting interface. SMO can be used to discover dependencies, understand the relationships between objects, and generate a .sql script that can re-create the objects in a database.

NOTE

The SqlScriptPublishModel and SMO are the same components used by the Scripting Wizard in SQL Server Management Studio (SSMS).

Sequence Diagram

PlantUML model