Update deploy-sql2019-image.ipynb (#6373)

This commit is contained in:
Alan Ren
2019-07-12 14:34:18 -07:00
committed by GitHub
parent 4bb3cdf114
commit 969476e49e

View File

@@ -44,10 +44,10 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"source": "md = f'docker ps -a'\r\nrun_command()", "source": "cmd = f'docker ps -a'\r\nrun_command()",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"execution_count": 3 "execution_count": 2
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
@@ -59,7 +59,7 @@
"source": "import getpass\r\npassword_name = 'SQL Server sa account password'\r\nsql_password = getpass.getpass(prompt = password_name)\r\npassword_confirm = getpass.getpass(prompt = f'Confirm {password_name}')\r\nif sql_password != password_confirm:\r\n raise SystemExit(f'{password_name} does not match the confirmation password')\r\nprint(f'{password_name}: ******')\r\nsql_port = input('SQL Server port, default value is 1433')\r\nif len(sql_port) == 0:\r\n sql_port = '1433'\r\nprint(f'Port: {sql_port}')", "source": "import getpass\r\npassword_name = 'SQL Server sa account password'\r\nsql_password = getpass.getpass(prompt = password_name)\r\npassword_confirm = getpass.getpass(prompt = f'Confirm {password_name}')\r\nif sql_password != password_confirm:\r\n raise SystemExit(f'{password_name} does not match the confirmation password')\r\nprint(f'{password_name}: ******')\r\nsql_port = input('SQL Server port, default value is 1433')\r\nif len(sql_port) == 0:\r\n sql_port = '1433'\r\nprint(f'Port: {sql_port}')",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"execution_count": 4 "execution_count": 3
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
@@ -71,7 +71,7 @@
"source": "cmd = f'docker pull mcr.microsoft.com/mssql/server:2019-latest'\r\nrun_command()", "source": "cmd = f'docker pull mcr.microsoft.com/mssql/server:2019-latest'\r\nrun_command()",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"execution_count": 5 "execution_count": 4
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
@@ -83,7 +83,7 @@
"source": "import time\r\ncontainer_name = 'sql2019-' + time.strftime(\"%Y%m%d%H%M%S\", time.localtime())\r\nprint('New container name: ' + container_name)\r\ncmd = f'docker run -e ACCEPT_EULA=Y -e \"SA_PASSWORD={sql_password}\" -p {sql_port}:1433 --name {container_name} -d mcr.microsoft.com/mssql/server:2019-latest'\r\nrun_command()", "source": "import time\r\ncontainer_name = 'sql2019-' + time.strftime(\"%Y%m%d%H%M%S\", time.localtime())\r\nprint('New container name: ' + container_name)\r\ncmd = f'docker run -e ACCEPT_EULA=Y -e \"SA_PASSWORD={sql_password}\" -p {sql_port}:1433 --name {container_name} -d mcr.microsoft.com/mssql/server:2019-latest'\r\nrun_command()",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"execution_count": 6 "execution_count": 5
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
@@ -95,7 +95,7 @@
"source": "cmd = f'docker ps -a'\r\nrun_command()", "source": "cmd = f'docker ps -a'\r\nrun_command()",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"execution_count": 7 "execution_count": 6
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
@@ -107,7 +107,7 @@
"source": "from IPython.display import *\r\ndisplay(HTML(\"<a href=\\\"command:azdata.connect?{&quot;serverName&quot;:&quot;localhost,\"+sql_port+\"&quot;,&quot;providerName&quot;:&quot;MSSQL&quot;, &quot;authenticationType&quot;:&quot;SqlLogin&quot;,&quot;userName&quot;:&quot;sa&quot;,&quot;password&quot;:&quot;\"+sql_password+\"&quot;}\\\">Click here to connect to SQL Server</a>\"))", "source": "from IPython.display import *\r\ndisplay(HTML(\"<a href=\\\"command:azdata.connect?{&quot;serverName&quot;:&quot;localhost,\"+sql_port+\"&quot;,&quot;providerName&quot;:&quot;MSSQL&quot;, &quot;authenticationType&quot;:&quot;SqlLogin&quot;,&quot;userName&quot;:&quot;sa&quot;,&quot;password&quot;:&quot;\"+sql_password+\"&quot;}\\\">Click here to connect to SQL Server</a>\"))",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"execution_count": 8 "execution_count": 7
}, },
{ {
"cell_type": "markdown", "cell_type": "markdown",
@@ -119,7 +119,7 @@
"source": "stop_container_command = f'docker stop {container_name}'\r\nremove_container_command = f'docker rm {container_name}'\r\ndisplay(HTML(\"Use this link to: <a href=\\\"command:workbench.action.terminal.focus\\\">open the terminal window in Azure Data Studio</a> and use the links below to paste the command to the terminal.\"))\r\ndisplay(HTML(\"Stop the container: <a href=\\\"command:workbench.action.terminal.sendSequence?%7B%22text%22%3A%22\"+stop_container_command.replace(\" \",\"%20\")+\"%22%7D\\\">\" + stop_container_command + \"</a>\"))\r\ndisplay(HTML(\"Remove the container: <a href=\\\"command:workbench.action.terminal.sendSequence?%7B%22text%22%3A%22\"+remove_container_command.replace(\" \",\"%20\")+\"%22%7D\\\">\" + remove_container_command + \"</a>\"))", "source": "stop_container_command = f'docker stop {container_name}'\r\nremove_container_command = f'docker rm {container_name}'\r\ndisplay(HTML(\"Use this link to: <a href=\\\"command:workbench.action.terminal.focus\\\">open the terminal window in Azure Data Studio</a> and use the links below to paste the command to the terminal.\"))\r\ndisplay(HTML(\"Stop the container: <a href=\\\"command:workbench.action.terminal.sendSequence?%7B%22text%22%3A%22\"+stop_container_command.replace(\" \",\"%20\")+\"%22%7D\\\">\" + stop_container_command + \"</a>\"))\r\ndisplay(HTML(\"Remove the container: <a href=\\\"command:workbench.action.terminal.sendSequence?%7B%22text%22%3A%22\"+remove_container_command.replace(\" \",\"%20\")+\"%22%7D\\\">\" + remove_container_command + \"</a>\"))",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"execution_count": 9 "execution_count": 8
} }
] ]
} }