mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-10 10:12:34 -05:00
notebook linebreak update (#7614)
This commit is contained in:
@@ -66,22 +66,22 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"import pandas,sys,os,json,html,getpass,time\r\n",
|
||||
"pandas_version = pandas.__version__.split('.')\r\n",
|
||||
"pandas_major = int(pandas_version[0])\r\n",
|
||||
"pandas_minor = int(pandas_version[1])\r\n",
|
||||
"pandas_patch = int(pandas_version[2])\r\n",
|
||||
"if not (pandas_major > 0 or (pandas_major == 0 and pandas_minor > 24) or (pandas_major == 0 and pandas_minor == 24 and pandas_patch >= 2)):\r\n",
|
||||
" sys.exit('Please upgrade the Notebook dependency before you can proceed, you can do it by running the \"Reinstall Notebook dependencies\" command in command palette (View menu -> Command Palette…).')\r\n",
|
||||
"def run_command(command):\r\n",
|
||||
" print(\"Executing: \" + command)\r\n",
|
||||
" !{command}\r\n",
|
||||
" if _exit_code != 0:\r\n",
|
||||
" sys.exit(f'Command execution failed with exit code: {str(_exit_code)}.\\n\\t{command}\\n')\r\n",
|
||||
" print(f'Successfully executed: {command}')\r\n",
|
||||
"\r\n",
|
||||
"run_command('kubectl version --client=true')\r\n",
|
||||
"run_command('azdata --version')\r\n",
|
||||
"import pandas,sys,os,json,html,getpass,time\n",
|
||||
"pandas_version = pandas.__version__.split('.')\n",
|
||||
"pandas_major = int(pandas_version[0])\n",
|
||||
"pandas_minor = int(pandas_version[1])\n",
|
||||
"pandas_patch = int(pandas_version[2])\n",
|
||||
"if not (pandas_major > 0 or (pandas_major == 0 and pandas_minor > 24) or (pandas_major == 0 and pandas_minor == 24 and pandas_patch >= 2)):\n",
|
||||
" sys.exit('Please upgrade the Notebook dependency before you can proceed, you can do it by running the \"Reinstall Notebook dependencies\" command in command palette (View menu -> Command Palette…).')\n",
|
||||
"def run_command(command):\n",
|
||||
" print(\"Executing: \" + command)\n",
|
||||
" !{command}\n",
|
||||
" if _exit_code != 0:\n",
|
||||
" sys.exit(f'Command execution failed with exit code: {str(_exit_code)}.\\n\\t{command}\\n')\n",
|
||||
" print(f'Successfully executed: {command}')\n",
|
||||
"\n",
|
||||
"run_command('kubectl version --client=true')\n",
|
||||
"run_command('azdata --version')\n",
|
||||
"run_command('az --version')"
|
||||
],
|
||||
"metadata": {
|
||||
@@ -345,7 +345,7 @@
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"### **Connect to SQL Server Master instance in Azure Data Studio**\r\n",
|
||||
"### **Connect to SQL Server Master instance in Azure Data Studio**\n",
|
||||
"Click the link below to connect to the SQL Server Master instance of the SQL Server 2019 Big Data Cluster."
|
||||
],
|
||||
"metadata": {
|
||||
@@ -355,11 +355,11 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"sqlEndpoints = [x for x in endpoints if x['name'] == 'sql-server-master']\r\n",
|
||||
"if sqlEndpoints and len(sqlEndpoints) == 1:\r\n",
|
||||
" connectionParameter = '{\"serverName\":\"' + sqlEndpoints[0]['endpoint'] + '\",\"providerName\":\"MSSQL\",\"authenticationType\":\"SqlLogin\",\"userName\":\"sa\",\"password\":' + json.dumps(mssql_password) + '}'\r\n",
|
||||
" display(HTML('<br/><a href=\"command:azdata.connect?' + html.escape(connectionParameter)+'\"><font size=\"3\">Click here to connect to SQL Server Master instance</font></a><br/>'))\r\n",
|
||||
"else:\r\n",
|
||||
"sqlEndpoints = [x for x in endpoints if x['name'] == 'sql-server-master']\n",
|
||||
"if sqlEndpoints and len(sqlEndpoints) == 1:\n",
|
||||
" connectionParameter = '{\"serverName\":\"' + sqlEndpoints[0]['endpoint'] + '\",\"providerName\":\"MSSQL\",\"authenticationType\":\"SqlLogin\",\"userName\":\"sa\",\"password\":' + json.dumps(mssql_password) + '}'\n",
|
||||
" display(HTML('<br/><a href=\"command:azdata.connect?' + html.escape(connectionParameter)+'\"><font size=\"3\">Click here to connect to SQL Server Master instance</font></a><br/>'))\n",
|
||||
"else:\n",
|
||||
" sys.exit('Could not find the SQL Server Master instance endpoint.')"
|
||||
],
|
||||
"metadata": {
|
||||
|
||||
@@ -65,21 +65,21 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"import pandas,sys,os,json,html,getpass,time\r\n",
|
||||
"pandas_version = pandas.__version__.split('.')\r\n",
|
||||
"pandas_major = int(pandas_version[0])\r\n",
|
||||
"pandas_minor = int(pandas_version[1])\r\n",
|
||||
"pandas_patch = int(pandas_version[2])\r\n",
|
||||
"if not (pandas_major > 0 or (pandas_major == 0 and pandas_minor > 24) or (pandas_major == 0 and pandas_minor == 24 and pandas_patch >= 2)):\r\n",
|
||||
" sys.exit('Please upgrade the Notebook dependency before you can proceed, you can do it by running the \"Reinstall Notebook dependencies\" command in command palette (View menu -> Command Palette…).')\r\n",
|
||||
"def run_command(command):\r\n",
|
||||
" print(\"Executing: \" + command)\r\n",
|
||||
" !{command}\r\n",
|
||||
" if _exit_code != 0:\r\n",
|
||||
" sys.exit(f'Command execution failed with exit code: {str(_exit_code)}.\\n\\t{command}\\n')\r\n",
|
||||
" print(f'Successfully executed: {command}')\r\n",
|
||||
"\r\n",
|
||||
"run_command('kubectl version --client=true')\r\n",
|
||||
"import pandas,sys,os,json,html,getpass,time\n",
|
||||
"pandas_version = pandas.__version__.split('.')\n",
|
||||
"pandas_major = int(pandas_version[0])\n",
|
||||
"pandas_minor = int(pandas_version[1])\n",
|
||||
"pandas_patch = int(pandas_version[2])\n",
|
||||
"if not (pandas_major > 0 or (pandas_major == 0 and pandas_minor > 24) or (pandas_major == 0 and pandas_minor == 24 and pandas_patch >= 2)):\n",
|
||||
" sys.exit('Please upgrade the Notebook dependency before you can proceed, you can do it by running the \"Reinstall Notebook dependencies\" command in command palette (View menu -> Command Palette…).')\n",
|
||||
"def run_command(command):\n",
|
||||
" print(\"Executing: \" + command)\n",
|
||||
" !{command}\n",
|
||||
" if _exit_code != 0:\n",
|
||||
" sys.exit(f'Command execution failed with exit code: {str(_exit_code)}.\\n\\t{command}\\n')\n",
|
||||
" print(f'Successfully executed: {command}')\n",
|
||||
"\n",
|
||||
"run_command('kubectl version --client=true')\n",
|
||||
"run_command('azdata --version')"
|
||||
],
|
||||
"metadata": {
|
||||
@@ -256,7 +256,7 @@
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"### **Connect to SQL Server Master instance in Azure Data Studio**\r\n",
|
||||
"### **Connect to SQL Server Master instance in Azure Data Studio**\n",
|
||||
"Click the link below to connect to the SQL Server Master instance of the SQL Server 2019 Big Data Cluster."
|
||||
],
|
||||
"metadata": {
|
||||
@@ -266,11 +266,11 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"sqlEndpoints = [x for x in endpoints if x['name'] == 'sql-server-master']\r\n",
|
||||
"if sqlEndpoints and len(sqlEndpoints) == 1:\r\n",
|
||||
" connectionParameter = '{\"serverName\":\"' + sqlEndpoints[0]['endpoint'] + '\",\"providerName\":\"MSSQL\",\"authenticationType\":\"SqlLogin\",\"userName\":\"sa\",\"password\":' + json.dumps(mssql_password) + '}'\r\n",
|
||||
" display(HTML('<br/><a href=\"command:azdata.connect?' + html.escape(connectionParameter)+'\"><font size=\"3\">Click here to connect to SQL Server Master instance</font></a><br/>'))\r\n",
|
||||
"else:\r\n",
|
||||
"sqlEndpoints = [x for x in endpoints if x['name'] == 'sql-server-master']\n",
|
||||
"if sqlEndpoints and len(sqlEndpoints) == 1:\n",
|
||||
" connectionParameter = '{\"serverName\":\"' + sqlEndpoints[0]['endpoint'] + '\",\"providerName\":\"MSSQL\",\"authenticationType\":\"SqlLogin\",\"userName\":\"sa\",\"password\":' + json.dumps(mssql_password) + '}'\n",
|
||||
" display(HTML('<br/><a href=\"command:azdata.connect?' + html.escape(connectionParameter)+'\"><font size=\"3\">Click here to connect to SQL Server Master instance</font></a><br/>'))\n",
|
||||
"else:\n",
|
||||
" sys.exit('Could not find the SQL Server Master instance endpoint')"
|
||||
],
|
||||
"metadata": {
|
||||
|
||||
@@ -65,21 +65,21 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"import pandas,sys,os,json,html,getpass,time\r\n",
|
||||
"pandas_version = pandas.__version__.split('.')\r\n",
|
||||
"pandas_major = int(pandas_version[0])\r\n",
|
||||
"pandas_minor = int(pandas_version[1])\r\n",
|
||||
"pandas_patch = int(pandas_version[2])\r\n",
|
||||
"if not (pandas_major > 0 or (pandas_major == 0 and pandas_minor > 24) or (pandas_major == 0 and pandas_minor == 24 and pandas_patch >= 2)):\r\n",
|
||||
" sys.exit('Please upgrade the Notebook dependency before you can proceed, you can do it by running the \"Reinstall Notebook dependencies\" command in command palette (View menu -> Command Palette…).')\r\n",
|
||||
"def run_command(command):\r\n",
|
||||
" print(\"Executing: \" + command)\r\n",
|
||||
" !{command}\r\n",
|
||||
" if _exit_code != 0:\r\n",
|
||||
" sys.exit(f'Command execution failed with exit code: {str(_exit_code)}.\\n\\t{command}\\n')\r\n",
|
||||
" print(f'Successfully executed: {command}')\r\n",
|
||||
"\r\n",
|
||||
"run_command('kubectl version --client=true')\r\n",
|
||||
"import pandas,sys,os,json,html,getpass,time\n",
|
||||
"pandas_version = pandas.__version__.split('.')\n",
|
||||
"pandas_major = int(pandas_version[0])\n",
|
||||
"pandas_minor = int(pandas_version[1])\n",
|
||||
"pandas_patch = int(pandas_version[2])\n",
|
||||
"if not (pandas_major > 0 or (pandas_major == 0 and pandas_minor > 24) or (pandas_major == 0 and pandas_minor == 24 and pandas_patch >= 2)):\n",
|
||||
" sys.exit('Please upgrade the Notebook dependency before you can proceed, you can do it by running the \"Reinstall Notebook dependencies\" command in command palette (View menu -> Command Palette…).')\n",
|
||||
"def run_command(command):\n",
|
||||
" print(\"Executing: \" + command)\n",
|
||||
" !{command}\n",
|
||||
" if _exit_code != 0:\n",
|
||||
" sys.exit(f'Command execution failed with exit code: {str(_exit_code)}.\\n\\t{command}\\n')\n",
|
||||
" print(f'Successfully executed: {command}')\n",
|
||||
"\n",
|
||||
"run_command('kubectl version --client=true')\n",
|
||||
"run_command('azdata --version')"
|
||||
],
|
||||
"metadata": {
|
||||
@@ -256,7 +256,7 @@
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"### **Connect to SQL Server Master instance in Azure Data Studio**\r\n",
|
||||
"### **Connect to SQL Server Master instance in Azure Data Studio**\n",
|
||||
"Click the link below to connect to the SQL Server Master instance of the SQL Server 2019 Big Data Cluster."
|
||||
],
|
||||
"metadata": {
|
||||
@@ -266,11 +266,11 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"sqlEndpoints = [x for x in endpoints if x['name'] == 'sql-server-master']\r\n",
|
||||
"if sqlEndpoints and len(sqlEndpoints) == 1:\r\n",
|
||||
" connectionParameter = '{\"serverName\":\"' + sqlEndpoints[0]['endpoint'] + '\",\"providerName\":\"MSSQL\",\"authenticationType\":\"SqlLogin\",\"userName\":\"sa\",\"password\":' + json.dumps(mssql_password) + '}'\r\n",
|
||||
" display(HTML('<br/><a href=\"command:azdata.connect?' + html.escape(connectionParameter)+'\"><font size=\"3\">Click here to connect to SQL Server Master instance</font></a><br/>'))\r\n",
|
||||
"else:\r\n",
|
||||
"sqlEndpoints = [x for x in endpoints if x['name'] == 'sql-server-master']\n",
|
||||
"if sqlEndpoints and len(sqlEndpoints) == 1:\n",
|
||||
" connectionParameter = '{\"serverName\":\"' + sqlEndpoints[0]['endpoint'] + '\",\"providerName\":\"MSSQL\",\"authenticationType\":\"SqlLogin\",\"userName\":\"sa\",\"password\":' + json.dumps(mssql_password) + '}'\n",
|
||||
" display(HTML('<br/><a href=\"command:azdata.connect?' + html.escape(connectionParameter)+'\"><font size=\"3\">Click here to connect to SQL Server Master instance</font></a><br/>'))\n",
|
||||
"else:\n",
|
||||
" sys.exit('Could not find the SQL Server Master instance endpoint')"
|
||||
],
|
||||
"metadata": {
|
||||
|
||||
@@ -23,13 +23,13 @@
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"\r\n",
|
||||
"## Run SQL Server 2017 container images with Docker\r\n",
|
||||
"This notebook will use Docker to pull and run the SQL Server 2017 container image and connect to it in Azure Data Studio\r\n",
|
||||
"\r\n",
|
||||
"### Dependencies\r\n",
|
||||
"- Docker Engine. For more information, see [Install Docker](https://docs.docker.com/engine/installation/).\r\n",
|
||||
"\r\n",
|
||||
"\n",
|
||||
"## Run SQL Server 2017 container images with Docker\n",
|
||||
"This notebook will use Docker to pull and run the SQL Server 2017 container image and connect to it in Azure Data Studio\n",
|
||||
"\n",
|
||||
"### Dependencies\n",
|
||||
"- Docker Engine. For more information, see [Install Docker](https://docs.docker.com/engine/installation/).\n",
|
||||
"\n",
|
||||
"<span style=\"color:red\"><font size=\"3\">Please press the \"Run Cells\" button to run the notebook</font></span>"
|
||||
],
|
||||
"metadata": {}
|
||||
@@ -42,22 +42,22 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"import pandas,sys,getpass,os,json,html,time\r\n",
|
||||
"pandas_version = pandas.__version__.split('.')\r\n",
|
||||
"pandas_major = int(pandas_version[0])\r\n",
|
||||
"pandas_minor = int(pandas_version[1])\r\n",
|
||||
"pandas_patch = int(pandas_version[2])\r\n",
|
||||
"if not (pandas_major > 0 or (pandas_major == 0 and pandas_minor > 24) or (pandas_major == 0 and pandas_minor == 24 and pandas_patch >= 2)):\r\n",
|
||||
" sys.exit('Please upgrade the Notebook dependency before you can proceed, you can do it by running the \"Reinstall Notebook dependencies\" command in command palette (View menu -> Command Palette…).')\r\n",
|
||||
"\r\n",
|
||||
"def run_command():\r\n",
|
||||
" print(\"Executing: \" + cmd)\r\n",
|
||||
" !{cmd}\r\n",
|
||||
" if _exit_code != 0:\r\n",
|
||||
" sys.exit(f'Command execution failed with exit code: {str(_exit_code)}.\\n\\t{cmd}\\n')\r\n",
|
||||
" print(f'Successfully executed: {cmd}')\r\n",
|
||||
"\r\n",
|
||||
"cmd = 'docker version'\r\n",
|
||||
"import pandas,sys,getpass,os,json,html,time\n",
|
||||
"pandas_version = pandas.__version__.split('.')\n",
|
||||
"pandas_major = int(pandas_version[0])\n",
|
||||
"pandas_minor = int(pandas_version[1])\n",
|
||||
"pandas_patch = int(pandas_version[2])\n",
|
||||
"if not (pandas_major > 0 or (pandas_major == 0 and pandas_minor > 24) or (pandas_major == 0 and pandas_minor == 24 and pandas_patch >= 2)):\n",
|
||||
" sys.exit('Please upgrade the Notebook dependency before you can proceed, you can do it by running the \"Reinstall Notebook dependencies\" command in command palette (View menu -> Command Palette…).')\n",
|
||||
"\n",
|
||||
"def run_command():\n",
|
||||
" print(\"Executing: \" + cmd)\n",
|
||||
" !{cmd}\n",
|
||||
" if _exit_code != 0:\n",
|
||||
" sys.exit(f'Command execution failed with exit code: {str(_exit_code)}.\\n\\t{cmd}\\n')\n",
|
||||
" print(f'Successfully executed: {cmd}')\n",
|
||||
"\n",
|
||||
"cmd = 'docker version'\n",
|
||||
"run_command()"
|
||||
],
|
||||
"metadata": {},
|
||||
@@ -67,7 +67,7 @@
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"### List existing containers\r\n",
|
||||
"### List existing containers\n",
|
||||
"You can view the ports that have been used by existing containers"
|
||||
],
|
||||
"metadata": {}
|
||||
@@ -75,7 +75,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"cmd = f'docker ps -a'\r\n",
|
||||
"cmd = f'docker ps -a'\n",
|
||||
"run_command()"
|
||||
],
|
||||
"metadata": {},
|
||||
@@ -90,20 +90,20 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"env_var_flag = \"AZDATA_NB_VAR_DOCKER_PASSWORD\" in os.environ\r\n",
|
||||
"password_name = 'SQL Server sa account password'\r\n",
|
||||
"if env_var_flag:\r\n",
|
||||
" sql_password = os.environ[\"AZDATA_NB_VAR_DOCKER_PASSWORD\"]\r\n",
|
||||
" sql_port = os.environ[\"AZDATA_NB_VAR_DOCKER_PORT\"]\r\n",
|
||||
"else:\r\n",
|
||||
" sql_password = getpass.getpass(prompt = password_name)\r\n",
|
||||
" password_confirm = getpass.getpass(prompt = f'Confirm {password_name}')\r\n",
|
||||
" if sql_password != password_confirm:\r\n",
|
||||
" sys.exit(f'{password_name} does not match the confirmation password.')\r\n",
|
||||
" sql_port = input('SQL Server port, default value is 1433')\r\n",
|
||||
" if len(sql_port) == 0:\r\n",
|
||||
" sql_port = '1433'\r\n",
|
||||
"print(f'{password_name}: ******')\r\n",
|
||||
"env_var_flag = \"AZDATA_NB_VAR_DOCKER_PASSWORD\" in os.environ\n",
|
||||
"password_name = 'SQL Server sa account password'\n",
|
||||
"if env_var_flag:\n",
|
||||
" sql_password = os.environ[\"AZDATA_NB_VAR_DOCKER_PASSWORD\"]\n",
|
||||
" sql_port = os.environ[\"AZDATA_NB_VAR_DOCKER_PORT\"]\n",
|
||||
"else:\n",
|
||||
" sql_password = getpass.getpass(prompt = password_name)\n",
|
||||
" password_confirm = getpass.getpass(prompt = f'Confirm {password_name}')\n",
|
||||
" if sql_password != password_confirm:\n",
|
||||
" sys.exit(f'{password_name} does not match the confirmation password.')\n",
|
||||
" sql_port = input('SQL Server port, default value is 1433')\n",
|
||||
" if len(sql_port) == 0:\n",
|
||||
" sql_port = '1433'\n",
|
||||
"print(f'{password_name}: ******')\n",
|
||||
"print(f'Port: {sql_port}')"
|
||||
],
|
||||
"metadata": {},
|
||||
@@ -118,7 +118,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"cmd = f'docker pull mcr.microsoft.com/mssql/server:2017-latest'\r\n",
|
||||
"cmd = f'docker pull mcr.microsoft.com/mssql/server:2017-latest'\n",
|
||||
"run_command()"
|
||||
],
|
||||
"metadata": {},
|
||||
@@ -133,12 +133,12 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"if env_var_flag:\r\n",
|
||||
" container_name = os.environ[\"AZDATA_NB_VAR_DOCKER_CONTAINER_NAME\"]\r\n",
|
||||
"else:\r\n",
|
||||
" container_name = 'sql2017-' + time.strftime(\"%Y%m%d%H%M%S\", time.localtime())\r\n",
|
||||
"print('New container name: ' + container_name)\r\n",
|
||||
"cmd = 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:2017-latest'\r\n",
|
||||
"if env_var_flag:\n",
|
||||
" container_name = os.environ[\"AZDATA_NB_VAR_DOCKER_CONTAINER_NAME\"]\n",
|
||||
"else:\n",
|
||||
" container_name = 'sql2017-' + time.strftime(\"%Y%m%d%H%M%S\", time.localtime())\n",
|
||||
"print('New container name: ' + container_name)\n",
|
||||
"cmd = 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:2017-latest'\n",
|
||||
"run_command()"
|
||||
],
|
||||
"metadata": {},
|
||||
@@ -153,7 +153,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"cmd = f'docker ps -a'\r\n",
|
||||
"cmd = f'docker ps -a'\n",
|
||||
"run_command()"
|
||||
],
|
||||
"metadata": {},
|
||||
@@ -163,7 +163,7 @@
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"### Connect to SQL Server in Azure Data Studio\r\n",
|
||||
"### Connect to SQL Server in Azure Data Studio\n",
|
||||
"It might take a couple minutes for SQL Server to launch"
|
||||
],
|
||||
"metadata": {}
|
||||
@@ -171,8 +171,8 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"from IPython.display import *\r\n",
|
||||
"connectionParameter = '{\"serverName\":\"localhost,' + sql_port + '\",\"providerName\":\"MSSQL\",\"authenticationType\":\"SqlLogin\",\"userName\":\"sa\",\"password\":' + json.dumps(sql_password) + '}'\r\n",
|
||||
"from IPython.display import *\n",
|
||||
"connectionParameter = '{\"serverName\":\"localhost,' + sql_port + '\",\"providerName\":\"MSSQL\",\"authenticationType\":\"SqlLogin\",\"userName\":\"sa\",\"password\":' + json.dumps(sql_password) + '}'\n",
|
||||
"display(HTML('<br/><a href=\"command:azdata.connect?' + html.escape(connectionParameter)+'\"><font size=\"3\">Click here to connect to SQL Server</font></a><br/>'))"
|
||||
],
|
||||
"metadata": {},
|
||||
@@ -187,10 +187,10 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"stop_container_command = f'docker stop {container_name}'\r\n",
|
||||
"remove_container_command = f'docker rm {container_name}'\r\n",
|
||||
"display(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\n",
|
||||
"display(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\n",
|
||||
"stop_container_command = f'docker stop {container_name}'\n",
|
||||
"remove_container_command = f'docker rm {container_name}'\n",
|
||||
"display(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.\"))\n",
|
||||
"display(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>\"))\n",
|
||||
"display(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": {},
|
||||
|
||||
@@ -23,13 +23,13 @@
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"\r\n",
|
||||
"## Run SQL Server 2019 container image with Docker\r\n",
|
||||
"This notebook will use Docker to pull and run the SQL Server 2019 container image and connect to it in Azure Data Studio\r\n",
|
||||
"\r\n",
|
||||
"### Dependencies\r\n",
|
||||
"- Docker Engine. For more information, see [Install Docker](https://docs.docker.com/engine/installation/).\r\n",
|
||||
"\r\n",
|
||||
"\n",
|
||||
"## Run SQL Server 2019 container image with Docker\n",
|
||||
"This notebook will use Docker to pull and run the SQL Server 2019 container image and connect to it in Azure Data Studio\n",
|
||||
"\n",
|
||||
"### Dependencies\n",
|
||||
"- Docker Engine. For more information, see [Install Docker](https://docs.docker.com/engine/installation/).\n",
|
||||
"\n",
|
||||
"<span style=\"color:red\"><font size=\"3\">Please press the \"Run Cells\" button to run the notebook</font></span>"
|
||||
],
|
||||
"metadata": {}
|
||||
@@ -42,22 +42,22 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"import pandas,sys,os,getpass,json,html,time\r\n",
|
||||
"pandas_version = pandas.__version__.split('.')\r\n",
|
||||
"pandas_major = int(pandas_version[0])\r\n",
|
||||
"pandas_minor = int(pandas_version[1])\r\n",
|
||||
"pandas_patch = int(pandas_version[2])\r\n",
|
||||
"if not (pandas_major > 0 or (pandas_major == 0 and pandas_minor > 24) or (pandas_major == 0 and pandas_minor == 24 and pandas_patch >= 2)):\r\n",
|
||||
" sys.exit('Please upgrade the Notebook dependency before you can proceed, you can do it by running the \"Reinstall Notebook dependencies\" command in command palette (View menu -> Command Palette…).')\r\n",
|
||||
"\r\n",
|
||||
"def run_command():\r\n",
|
||||
" print(\"Executing: \" + cmd)\r\n",
|
||||
" !{cmd}\r\n",
|
||||
" if _exit_code != 0:\r\n",
|
||||
" sys.exit(f'Command execution failed with exit code: {str(_exit_code)}.\\n\\t{cmd}\\n')\r\n",
|
||||
" print(f'Successfully executed: {cmd}')\r\n",
|
||||
"\r\n",
|
||||
"cmd = 'docker version'\r\n",
|
||||
"import pandas,sys,os,getpass,json,html,time\n",
|
||||
"pandas_version = pandas.__version__.split('.')\n",
|
||||
"pandas_major = int(pandas_version[0])\n",
|
||||
"pandas_minor = int(pandas_version[1])\n",
|
||||
"pandas_patch = int(pandas_version[2])\n",
|
||||
"if not (pandas_major > 0 or (pandas_major == 0 and pandas_minor > 24) or (pandas_major == 0 and pandas_minor == 24 and pandas_patch >= 2)):\n",
|
||||
" sys.exit('Please upgrade the Notebook dependency before you can proceed, you can do it by running the \"Reinstall Notebook dependencies\" command in command palette (View menu -> Command Palette…).')\n",
|
||||
"\n",
|
||||
"def run_command():\n",
|
||||
" print(\"Executing: \" + cmd)\n",
|
||||
" !{cmd}\n",
|
||||
" if _exit_code != 0:\n",
|
||||
" sys.exit(f'Command execution failed with exit code: {str(_exit_code)}.\\n\\t{cmd}\\n')\n",
|
||||
" print(f'Successfully executed: {cmd}')\n",
|
||||
"\n",
|
||||
"cmd = 'docker version'\n",
|
||||
"run_command()"
|
||||
],
|
||||
"metadata": {},
|
||||
@@ -67,7 +67,7 @@
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"### List existing containers\r\n",
|
||||
"### List existing containers\n",
|
||||
"You can view the ports that have been used by existing containers"
|
||||
],
|
||||
"metadata": {}
|
||||
@@ -75,7 +75,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"cmd = f'docker ps -a'\r\n",
|
||||
"cmd = f'docker ps -a'\n",
|
||||
"run_command()"
|
||||
],
|
||||
"metadata": {},
|
||||
@@ -90,20 +90,20 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"env_var_flag = \"AZDATA_NB_VAR_DOCKER_PASSWORD\" in os.environ\r\n",
|
||||
"password_name = 'SQL Server sa account password'\r\n",
|
||||
"if env_var_flag:\r\n",
|
||||
" sql_password = os.environ[\"AZDATA_NB_VAR_DOCKER_PASSWORD\"]\r\n",
|
||||
" sql_port = os.environ[\"AZDATA_NB_VAR_DOCKER_PORT\"]\r\n",
|
||||
"else:\r\n",
|
||||
" sql_password = getpass.getpass(prompt = password_name)\r\n",
|
||||
" password_confirm = getpass.getpass(prompt = f'Confirm {password_name}')\r\n",
|
||||
" if sql_password != password_confirm:\r\n",
|
||||
" raise SystemExit(f'{password_name} does not match the confirmation password.')\r\n",
|
||||
" sql_port = input('SQL Server port, default value is 1433')\r\n",
|
||||
" if len(sql_port) == 0:\r\n",
|
||||
" sql_port = '1433'\r\n",
|
||||
"print(f'{password_name}: ******')\r\n",
|
||||
"env_var_flag = \"AZDATA_NB_VAR_DOCKER_PASSWORD\" in os.environ\n",
|
||||
"password_name = 'SQL Server sa account password'\n",
|
||||
"if env_var_flag:\n",
|
||||
" sql_password = os.environ[\"AZDATA_NB_VAR_DOCKER_PASSWORD\"]\n",
|
||||
" sql_port = os.environ[\"AZDATA_NB_VAR_DOCKER_PORT\"]\n",
|
||||
"else:\n",
|
||||
" sql_password = getpass.getpass(prompt = password_name)\n",
|
||||
" password_confirm = getpass.getpass(prompt = f'Confirm {password_name}')\n",
|
||||
" if sql_password != password_confirm:\n",
|
||||
" raise SystemExit(f'{password_name} does not match the confirmation password.')\n",
|
||||
" sql_port = input('SQL Server port, default value is 1433')\n",
|
||||
" if len(sql_port) == 0:\n",
|
||||
" sql_port = '1433'\n",
|
||||
"print(f'{password_name}: ******')\n",
|
||||
"print(f'Port: {sql_port}')"
|
||||
],
|
||||
"metadata": {},
|
||||
@@ -118,7 +118,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"cmd = f'docker pull mcr.microsoft.com/mssql/server:2019-latest'\r\n",
|
||||
"cmd = f'docker pull mcr.microsoft.com/mssql/server:2019-latest'\n",
|
||||
"run_command()"
|
||||
],
|
||||
"metadata": {},
|
||||
@@ -133,12 +133,12 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"if env_var_flag:\r\n",
|
||||
" container_name = os.environ[\"AZDATA_NB_VAR_DOCKER_CONTAINER_NAME\"]\r\n",
|
||||
"else:\r\n",
|
||||
" container_name = 'sql2019-' + time.strftime(\"%Y%m%d%H%M%S\", time.localtime())\r\n",
|
||||
"print('New container name: ' + container_name)\r\n",
|
||||
"cmd = 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\n",
|
||||
"if env_var_flag:\n",
|
||||
" container_name = os.environ[\"AZDATA_NB_VAR_DOCKER_CONTAINER_NAME\"]\n",
|
||||
"else:\n",
|
||||
" container_name = 'sql2019-' + time.strftime(\"%Y%m%d%H%M%S\", time.localtime())\n",
|
||||
"print('New container name: ' + container_name)\n",
|
||||
"cmd = 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'\n",
|
||||
"run_command()"
|
||||
],
|
||||
"metadata": {},
|
||||
@@ -153,7 +153,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"cmd = f'docker ps -a'\r\n",
|
||||
"cmd = f'docker ps -a'\n",
|
||||
"run_command()"
|
||||
],
|
||||
"metadata": {},
|
||||
@@ -163,7 +163,7 @@
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"source": [
|
||||
"### Connect to SQL Server in Azure Data Studio\r\n",
|
||||
"### Connect to SQL Server in Azure Data Studio\n",
|
||||
"It might take a couple minutes for SQL Server to launch"
|
||||
],
|
||||
"metadata": {}
|
||||
@@ -171,8 +171,8 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"from IPython.display import *\r\n",
|
||||
"connectionParameter = '{\"serverName\":\"localhost,' + sql_port + '\",\"providerName\":\"MSSQL\",\"authenticationType\":\"SqlLogin\",\"userName\":\"sa\",\"password\":' + json.dumps(sql_password) + '}'\r\n",
|
||||
"from IPython.display import *\n",
|
||||
"connectionParameter = '{\"serverName\":\"localhost,' + sql_port + '\",\"providerName\":\"MSSQL\",\"authenticationType\":\"SqlLogin\",\"userName\":\"sa\",\"password\":' + json.dumps(sql_password) + '}'\n",
|
||||
"display(HTML('<br/><a href=\"command:azdata.connect?' + html.escape(connectionParameter)+'\"><font size=\"3\">Click here to connect to SQL Server</font></a><br/>'))"
|
||||
],
|
||||
"metadata": {},
|
||||
@@ -187,10 +187,10 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"stop_container_command = f'docker stop {container_name}'\r\n",
|
||||
"remove_container_command = f'docker rm {container_name}'\r\n",
|
||||
"display(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\n",
|
||||
"display(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\n",
|
||||
"stop_container_command = f'docker stop {container_name}'\n",
|
||||
"remove_container_command = f'docker rm {container_name}'\n",
|
||||
"display(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.\"))\n",
|
||||
"display(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>\"))\n",
|
||||
"display(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": {},
|
||||
|
||||
@@ -137,7 +137,7 @@ export class BigDataClusterDeploymentProfile {
|
||||
}
|
||||
|
||||
public set controllerDataStorageSize(value: number) {
|
||||
this._controlConfig.spec.storage.data.size = value;
|
||||
this._controlConfig.spec.storage.data.size = `${value}Gi`;
|
||||
}
|
||||
|
||||
public get controllerLogsStorageClass(): string {
|
||||
@@ -153,7 +153,7 @@ export class BigDataClusterDeploymentProfile {
|
||||
}
|
||||
|
||||
public set controllerLogsStorageSize(value: number) {
|
||||
this._controlConfig.spec.storage.logs.size = value;
|
||||
this._controlConfig.spec.storage.logs.size = `${value}Gi`;
|
||||
}
|
||||
|
||||
public setResourceStorage(resourceName: 'data-0' | 'master' | 'storage-0', dataStorageClass: string, dataStorageSize: number, logsStorageClass: string, logsStorageSize: number) {
|
||||
|
||||
@@ -85,7 +85,7 @@ export class DeployClusterWizardModel extends Model {
|
||||
Number.parseInt(this.getStorageSettingValue(VariableNames.DataPoolLogsStorageSize_VariableName, VariableNames.ControllerLogsStorageSize_VariableName)!)
|
||||
);
|
||||
targetDeploymentProfile.setResourceStorage(SqlServerMasterResource,
|
||||
this.getStorageSettingValue(VariableNames.SQLServerDNSName_VariableName, VariableNames.ControllerDataStorageClassName_VariableName)!,
|
||||
this.getStorageSettingValue(VariableNames.SQLServerDataStorageClassName_VariableName, VariableNames.ControllerDataStorageClassName_VariableName)!,
|
||||
Number.parseInt(this.getStorageSettingValue(VariableNames.SQLServerDataStorageSize_VariableName, VariableNames.ControllerDataStorageSize_VariableName)!),
|
||||
this.getStorageSettingValue(VariableNames.SQLServerLogsStorageClassName_VariableName, VariableNames.ControllerLogsStorageClassName_VariableName)!,
|
||||
Number.parseInt(this.getStorageSettingValue(VariableNames.SQLServerLogsStorageSize_VariableName, VariableNames.ControllerLogsStorageSize_VariableName)!)
|
||||
@@ -133,7 +133,7 @@ export class DeployClusterWizardModel extends Model {
|
||||
statements.push(`azure_vm_count = '${this.getStringValue(VariableNames.VMCount_VariableName)}'`);
|
||||
statements.push(`aks_cluster_name = '${this.getStringValue(VariableNames.AksName_VariableName)}'`);
|
||||
} else if (this.deploymentTarget === BdcDeploymentType.ExistingAKS || this.deploymentTarget === BdcDeploymentType.ExistingKubeAdm) {
|
||||
statements.push(`mssql_kube_config_path = '${this.getStringValue(VariableNames.KubeConfigPath_VariableName)}'`);
|
||||
statements.push(`mssql_kube_config_path = '${this.escapeForNotebookCodeCell(this.getStringValue(VariableNames.KubeConfigPath_VariableName)!)}'`);
|
||||
statements.push(`mssql_cluster_context = '${this.getStringValue(VariableNames.ClusterContext_VariableName)}'`);
|
||||
statements.push('os.environ["KUBECONFIG"] = mssql_kube_config_path');
|
||||
}
|
||||
@@ -144,6 +144,11 @@ export class DeployClusterWizardModel extends Model {
|
||||
statements.push(`print('Variables have been set successfully.')`);
|
||||
return statements.join(EOL);
|
||||
}
|
||||
|
||||
private escapeForNotebookCodeCell(original: string): string {
|
||||
// Escape the \ character for the code cell string value
|
||||
return original && original.replace(/\\/g, '\\\\');
|
||||
}
|
||||
}
|
||||
|
||||
export enum AuthenticationMode {
|
||||
|
||||
@@ -148,7 +148,7 @@ export class SummaryPage extends WizardPageBase<DeployClusterWizard> {
|
||||
{
|
||||
type: FieldType.ReadonlyText,
|
||||
label: localize('deployCluster.Region', "Region"),
|
||||
defaultValue: this.wizard.model.getStringValue(VariableNames.DeploymentProfile_VariableName),
|
||||
defaultValue: this.wizard.model.getStringValue(VariableNames.Region_VariableName),
|
||||
fontStyle: FontStyle.Italic
|
||||
}, {
|
||||
type: FieldType.ReadonlyText,
|
||||
|
||||
@@ -18,8 +18,8 @@ import { TitledComponent } from 'sql/workbench/browser/modelComponents/titledCom
|
||||
@Component({
|
||||
selector: 'modelview-text',
|
||||
template: `
|
||||
<div *ngIf="showDiv;else noDiv" style="display:flex;flex-flow:row;align-items:center;" [style.width]="getWidth()">
|
||||
<p [innerHTML]="getValue()" [style.width]="getWidth()" [style.height]="getHeight()" [title]="title" [ngStyle]="this.CSSStyles" (click)="onClick()"></p>
|
||||
<div *ngIf="showDiv;else noDiv" style="display:flex;flex-flow:row;align-items:center;" [style.width]="getWidth()" [style.height]="getHeight()">
|
||||
<p [innerHTML]="getValue()" [title]="title" [ngStyle]="this.CSSStyles" (click)="onClick()"></p>
|
||||
<p *ngIf="requiredIndicator" style="color:red;margin-left:5px;">*</p>
|
||||
<div *ngIf="description" tabindex="0" class="modelview-text-tooltip" [attr.aria-label]="description">
|
||||
<div class="modelview-text-tooltip-content" [innerHTML]="description"></div>
|
||||
|
||||
Reference in New Issue
Block a user