This repository has been archived by the owner on May 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
55 changed files
with
8,170 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[bumpversion] | ||
current_version = 1.0.0a18 | ||
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)((?P<release>.*))(?P<release_version>\d+) | ||
serialize = | ||
{major}.{minor}.{patch}{release}{release_version} | ||
|
||
[bumpversion:part:release] | ||
optional_value = production | ||
values = | ||
a | ||
rc | ||
production | ||
|
||
[bumpversion:file:setup.py] | ||
|
||
[bumpversion:file:mssqltoolsservice/setup.py] | ||
|
||
[bumpversion:file:mssqlscripter/__init__.py] | ||
|
||
[bumpversion:file:mssqltoolsservice/mssqltoolsservice/__init__.py] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# baseline files need to retain crlf for cross plat tests that simulate sql tools service response | ||
*.txt text eol=crlf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
sudo: True | ||
language: python | ||
matrix: | ||
include: | ||
- os: osx | ||
language: generic | ||
env: TOXENV=py36 | ||
- os: osx | ||
language: generic | ||
env: TOXENV=py27 | ||
- os: linux | ||
python: "2.7" | ||
- os: linux | ||
python: "3.3" | ||
- os: linux | ||
python: "3.4" | ||
- os: linux | ||
python: "3.5" | ||
- os: linux | ||
python: "3.6" | ||
before_install: | ||
- if [["$TRAVIS_OS_NAME" == "linux"]]; then $ apt-get update; fi | ||
- if [["$TRAVIS_OS_NAME" == "linux"]]; then $ apt-get install libunwind8; fi | ||
- if [[ ( "$TRAVIS_OS_NAME" == "osx" ) && ( "$TOXENV" == "py36" ) ]]; then brew update; fi | ||
- if [[ ( "$TRAVIS_OS_NAME" == "osx" ) && ( "$TOXENV" == "py36" ) ]]; then brew install python3; fi | ||
install: | ||
- pip install codecov | ||
- pip install tox-travis | ||
script: | ||
- tox | ||
after_success: | ||
- codecov |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Microsoft SQL Scripter | ||
|
||
Copyright (c) Microsoft Corporation | ||
|
||
All rights reserved. | ||
|
||
MIT License | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
include LICENSE.txt | ||
include README.rst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
.. image:: https://travis-ci.org/Microsoft/sql-xplat-cli.svg?branch=dev | ||
:target: https://travis-ci.org/Microsoft/sql-xplat-cli | ||
|
||
.. image:: https://ci.appveyor.com/api/projects/status/vpm8p71265ijytqs/branch/dev?svg=true | ||
:target: https://ci.appveyor.com/project/MrMeemus/sql-xplat-cli | ||
|
||
.. image:: https://codecov.io/gh/Microsoft/sql-xplat-cli/branch/dev/graph/badge.svg?token=M96uWrHOIu | ||
:target: https://codecov.io/gh/Microsoft/sql-xplat-cli/branch/dev | ||
|
||
.. image:: https://badge.fury.io/py/mssql-scripter.svg | ||
:target: https://pypi.python.org/pypi/mssql-scripter | ||
|
||
.. image:: https://img.shields.io/pypi/pyversions/mssql-scripter.svg | ||
:target: https://travis-ci.org/Microsoft/sql-xplat-cli | ||
|
||
mssql-scripter | ||
=============== | ||
We’re excited to introduce mssql-scripter, a multi-platform command line | ||
experience for scripting SQL Server databases. | ||
|
||
mssql-scripter is the multiplatform command line equivalent of the widely used Generate Scripts Wizard experience in SSMS. You can use mssql-scripter on Linux, macOS, and Windows to generate data definition language (DDL) and data manipulation language (DML) T-SQL scripts for database objects in SQL Server running anywhere, Azure SQL Database, and Azure SQL Data Warehouse. You can save the generated T-SQL script to a .sql file or pipe it to standard nix utilities (for example, sed, awk, grep) for further transformations. You can edit the generated script or check it into source control and subsequently execute the script in your existing SQL database deployment processes and DevOps pipelines with standard multiplatform SQL command line tools such as sqlcmd. | ||
|
||
mssql-scripter is built using Python and incorporates the usability principles of the new Azure CLI 2.0 tools. | ||
|
||
Installation | ||
------------ | ||
|
||
.. code:: bash | ||
$ pip install mssql-scripter | ||
Please refer to the `installation guide`_ for detailed install instructions. | ||
|
||
Usage | ||
----- | ||
|
||
Please refer to the `usage guide`_ for details on options and example usage. | ||
|
||
For general help content, pass in the ``-h`` parameter: | ||
|
||
.. code:: bash | ||
$ mssql-scripter -h | ||
Contributing | ||
----------------------------- | ||
If you would like to contribute to the project, please refer to the `development guide`_. | ||
|
||
Reporting issues and feedback | ||
----------------------------- | ||
|
||
If you encounter any bugs with the tool please file an issue in the | ||
`Issues`_ section of our GitHub repo. | ||
|
||
Code of Conduct | ||
--------------- | ||
|
||
This project has adopted the `Microsoft Open Source Code of Conduct`_. | ||
|
||
For more information see the `Code of Conduct FAQ`_ or contact | ||
[email protected] with any additional questions or comments. | ||
|
||
License | ||
------- | ||
|
||
mssql-scritper is licensed under the `MIT license`_. | ||
|
||
.. _installation guide: doc/installation_guide.md | ||
.. _development guide: doc/development_guide.md | ||
.. _usage guide: doc/usage_guide.md | ||
.. _Issues: https://github.com/Microsoft/sql-xplat-cli/issues | ||
.. _Microsoft Open Source Code of Conduct: https://opensource.microsoft.com/codeofconduct/ | ||
.. _Code of Conduct FAQ: https://opensource.microsoft.com/codeofconduct/faq/ | ||
.. _MIT license: https://github.com/Microsoft/sql-xplat-cli/blob/dev/LI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
environment: | ||
|
||
matrix: | ||
- TOXENV: "py27" | ||
PYTHON: "C:\\Python27" | ||
- TOXENV: "py33" | ||
PYTHON: "C:\\Python33" | ||
- TOXENV: "py34" | ||
PYTHON: "C:\\Python34" | ||
- TOXENV: "py35" | ||
PYTHON: "C:\\Python35" | ||
- TOXENV: "py36" | ||
PYTHON: "C:\\Python36" | ||
|
||
install: | ||
- "%PYTHON%\\python.exe -m pip install -r dev_requirements.txt" | ||
- "%PYTHON%\\python.exe -m pip install codecov" | ||
build: off | ||
|
||
test_script: | ||
- "%PYTHON%\\python.exe -m tox" | ||
|
||
on_success: | ||
- "%PYTHON%\\Scripts\\codecov.exe -f coverage.xml" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
enum34 >= 1.1.6 | ||
future >= 0.16.0 | ||
setuptools >= 36.0.1 | ||
requests >= 2.13.0 | ||
wheel >= 0.29.0 | ||
coverage >= 4.3.4 | ||
twine >= 1.8.1 | ||
bumpversion >= 0.5.3 | ||
tox >= 2.7.0 | ||
flake8 >= 3.3.0 | ||
pytest >= 3.0.7 | ||
pytest-cov >= 2.5.1 | ||
readme_renderer >= 17.2 | ||
docutils >= 0.13.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env python | ||
|
||
|
||
# -------------------------------------------------------------------------------------------- | ||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the MIT License. See License.txt in the project root for license information. | ||
# -------------------------------------------------------------------------------------------- | ||
|
||
from __future__ import print_function | ||
|
||
import os | ||
import setup | ||
import utility | ||
|
||
root_dir = os.path.abspath(os.path.join(os.path.abspath(__file__), '..')) | ||
|
||
print('Running dev setup...') | ||
print('Root directory \'{}\'\n'.format(root_dir)) | ||
|
||
# install general requirements. | ||
utility.exec_command('pip install -r dev_requirements.txt', root_dir) | ||
|
||
# install mssqltoolsservice if this platform supports it. | ||
mssqltoolsservice_package_name = os.environ['MSSQLTOOLSSERVICE_PACKAGE_NAME'] | ||
print('Installing {}...'.format(mssqltoolsservice_package_name)) | ||
# mssqltoolsservice package name is retrieved from environment variable set by setup.py. | ||
utility.exec_command('pip install {}'.format(mssqltoolsservice_package_name), root_dir) | ||
|
||
print('Finished dev setup.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# 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](https://docs.microsoft.com/en-us/dotnet/articles/core/deploying/#self-contained-deployments-scd) [.NET Core](https://docs.microsoft.com/en-us/dotnet/articles/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](https://github.com/Microsoft/vscode-mssql) extension. The SqlToolsService is an open source project and hosted on github at [Microsoft/sqltoolsservice](https://github.com/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](https://docs.microsoft.com/en-us/sql/relational-databases/server-management-objects-smo/overview-smo) 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](https://docs.microsoft.com/en-us/sql/relational-databases/scripting/generate-scripts-sql-server-management-studio) in [SQL Server Management Studio (SSMS)](https://docs.microsoft.com/en-us/sql/ssms/sql-server-management-studio-ssms). | ||
|
||
# Sequence Diagram | ||
|
||
 |
Oops, something went wrong.