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

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
pensivebrian committed Aug 9, 2017
2 parents a06c4cd + ca49239 commit 0717f08
Show file tree
Hide file tree
Showing 55 changed files with 8,170 additions and 24 deletions.
21 changes: 21 additions & 0 deletions .bumpversion.cfg
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]

2 changes: 2 additions & 0 deletions .gitattributes
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
35 changes: 35 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,38 @@ ENV/

# Rope project settings
.ropeproject

# DS Store
.DS_Store

# sqltoolsservice binaries
/mssqlscripter/sqltoolsservice/*
/mssqltoolsservice/mssqltoolsservice/bin/*


# VSCode configuration
.vscode/*

# Visual Studio User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates

# MonoDevelop/Xamarin Studio User-specific files
*.userprefs

# Visual Studio Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/

# Visual Studio 2015 cache/options directory
.vs/
32 changes: 32 additions & 0 deletions .travis.yml
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
21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

13 changes: 13 additions & 0 deletions LICENSE.txt
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.
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include LICENSE.txt
include README.rst
3 changes: 0 additions & 3 deletions README.md

This file was deleted.

74 changes: 74 additions & 0 deletions README.rst
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
24 changes: 24 additions & 0 deletions appveyor.yml
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"
14 changes: 14 additions & 0 deletions dev_requirements.txt
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
29 changes: 29 additions & 0 deletions dev_setup.py
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.')
38 changes: 38 additions & 0 deletions doc/architecture_guide.md
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

![PlantUML model](http://www.plantuml.com/plantuml/png/tLDBJiCm4Dtx5AFkqmDK4H8g4XAYj10ku2P3Qycn4tjI54wFxNnAurIKBJjxtipaVHmI915AQskPsDo8Yj10XdM3AaTu4FnWUCaOpqaRM5psBO1Rw2uirugCbb1oePPLwn5_7EjPBT-rbdOj1IgAoXcQayYHEKnG2rbOAjHXMgzb1-sQlHJskD45oX7SR5d1YU-vHLXahy_WfptD-mm6O6XUB9qI-10IWmf_OApJ0ibTu0uhC8s2ggMZLYnK778fnFKe_9mMsUJ-OwmNvEOiSKDG6PsZjTVNzvn6ONEx9sxDJ3rbsvVaRRS6uwErDDsI9h7dWP87BgEBljQnZdDnD1vHeU647HYup_Jv1Pjjp9hvQkhGKSOAkEAo_K9m1TarEDodTnuFqDcdWMQQ95TvkXGEniSGsPBC93Tqdrt5Kt3c5xhmt_ZESFFlnMSPFvFqkfo_YSzrMKaal4tyq1s9l-aNrLNqX_PcICsBxZmYlJ_ES55XXv5sImhT4Fi6)
Loading

0 comments on commit 0717f08

Please sign in to comment.