diff --git a/samples/features/r-services/loan-classification/README.md b/samples/features/r-services/loan-classification/README.md index a309fc1c..06efc2c8 100644 --- a/samples/features/r-services/loan-classification/README.md +++ b/samples/features/r-services/loan-classification/README.md @@ -1,6 +1,6 @@ # Loan Classification using SQL Server 2016 R Services # -Joseph Sirosh, Data Group Corporate Vice President, had shown during his keynote session how customers are able to achieve a scale up of 1 million predictions/sec using SQL Server 2016 R Services. This sample contains all the scripts required to emulate a similar setup using Lending Club data with SQL Server 2016 R Services and an Azure Data Science VM. +During an Ignite keynote session, we had shown how customers are able to achieve a scale up of 1 million predictions/sec using SQL Server 2016 R Services. This sample contains all the scripts required to emulate a similar setup using Lending Club data with SQL Server 2016 R Services and an Azure Data Science VM. **Scripts** * 1 - Create Database.sql - Creates the database, tables, stored procedures and other associated database objects required to get this sample going diff --git a/samples/features/sql-big-data-cluster/bootstrap-sample-db.cmd b/samples/features/sql-big-data-cluster/bootstrap-sample-db.cmd index d74b8ae2..347e06cf 100644 --- a/samples/features/sql-big-data-cluster/bootstrap-sample-db.cmd +++ b/samples/features/sql-big-data-cluster/bootstrap-sample-db.cmd @@ -38,6 +38,7 @@ REM Copy the backup file, restore the database, create necessary objects and dat echo Copying sales database backup file to SQL Master instance... %DEBUG% kubectl cp tpcxbb_1gb.bak mssql-master-pool-0:/var/opt/mssql/data -c mssql-server -n %CLUSTER_NAMESPACE% || goto exit +REM Download and copy the sample backup files if /i %AW_WWI_SAMPLES% EQU --install-extra-samples ( if NOT EXIST AdventureWorks2016_EXT.bak ( echo Downloading AdventureWorks2016_EXT sample database backup file... @@ -71,6 +72,10 @@ if /i %AW_WWI_SAMPLES% EQU --install-extra-samples ( echo Configuring sample database(s)... %DEBUG% sqlcmd -S %SQL_MASTER_INSTANCE% -Usa -P%SQL_MASTER_SA_PASSWORD% -i "%STARTUP_PATH%bootstrap-sample-db.sql" -o "bootstrap.out" -I -b -v SA_PASSWORD="%KNOX_PASSWORD%" || goto exit +REM remove files copied into the pod: +echo Removing database backup files... +kubectl exec mssql-master-pool-0 -c mssql-server -i -t -- bash -c "rm -rvf /var/opt/mssql/data/*.bak" + for %%F in (web_clickstreams inventory customer) do ( if NOT EXIST %%F.csv ( echo Exporting %%F data... diff --git a/samples/features/sql-big-data-cluster/bootstrap-sample-db.sh b/samples/features/sql-big-data-cluster/bootstrap-sample-db.sh index 92fb198c..f3f65b01 100644 --- a/samples/features/sql-big-data-cluster/bootstrap-sample-db.sh +++ b/samples/features/sql-big-data-cluster/bootstrap-sample-db.sh @@ -78,6 +78,10 @@ echo Configuring sample database... export SA_PASSWORD=$KNOX_PASSWORD $DEBUG sqlcmd -S $SQL_MASTER_INSTANCE -Usa -P$SQL_MASTER_SA_PASSWORD -I -b < "$STARTUP_PATH/bootstrap-sample-db.sql" > "bootstrap.out" || (echo $ERROR_MESSAGE && exit 2) +# remove files copied into the pod: +echo Removing database backup files... +kubectl exec mssql-master-pool-0 -c mssql-server -i -t -- bash -c "rm -rvf /var/opt/mssql/data/*.bak" + for table in web_clickstreams inventory customer do echo Exporting $table data... diff --git a/samples/features/sql-big-data-cluster/data-virtualization/generic-odbc/README.md b/samples/features/sql-big-data-cluster/data-virtualization/generic-odbc/README.md new file mode 100644 index 00000000..7cffea0b --- /dev/null +++ b/samples/features/sql-big-data-cluster/data-virtualization/generic-odbc/README.md @@ -0,0 +1,41 @@ +# Data virtualization in SQL Server 2019 + +***Applies to:*** SQL Server 2019 on Windows only + +SQL Server 2019 introduces new ODBC connectors to data sources like SQL Server, Oracle, MongoDB and Teradata. The generic ODBC +connector can also be used to connect to other data sources like PostgreSQL, MySQL, IBM DB2 or any data source that provides +an ODBC driver. The ability to use the generic ODBC connector from SQL Server will be available only on Windows platform. + +The steps to use the generic ODBC connector are: + +1. Install the 64-bit ODBC Driver for the data source (ex: PostgreSQL, MySQL, IBM DB2, SAP HANA) on the SQL Server machine +1. Installation of the ODBC driver should be done at the system level +1. Use the Windows Control Panel ODBC applet (odbcad32) to determine the name of the ODBC Driver or refer to the ODBC Driver documentation + +## Query data in PostgreSQL from SQL Server + +In this example, you are going to create an external table in a SQL Server 2019 instance on Windows over the pg_tables view that sits on a PostgreSQL 11 server. The driver used to connect to the PostgreSQL server was the ***PostgreSQL ODBC Driver(UNICODE)*** driver. + +**Before you begin**, you need to have the PostgreSQL instance name and credentials + +### Instructions + +1. Connect to a SQL Server 2019 Windows instance and database. + +1. Modify the parameters in [postgresql/pg_tables.sql](postgresql/pg_tables.sql/). + +1. Execute the SQL [postgresql/pg_tables.sql](postgresql/pg_tables.sql/). + +## Query data in MySQL from SQL Server + +In this example, you are going to create an external table in a SQL Server instance on Windows over the pg_tables view that sits on a MySQL 8.0 server. The driver used to connect to the MySQL server was the ***MySQL 8.0 ODBC Driver Unicode Driver*** driver. + +**Before you begin**, you need to have the PostgreSQL instance name and credentials + +### Instructions + +1. Connect to a SQL Server 2019 Windows instance and database. + +1. Modify the parameters in [mysql/mysql_version.sql](mysql/mysql_version.sql/). + +1. Execute the SQL [mysql/mysql_version.sql](mysql/mysql_version.sql/). diff --git a/samples/features/sql-big-data-cluster/data-virtualization/generic-odbc/mysql/mysql_version.sql b/samples/features/sql-big-data-cluster/data-virtualization/generic-odbc/mysql/mysql_version.sql new file mode 100644 index 00000000..1267e9ff --- /dev/null +++ b/samples/features/sql-big-data-cluster/data-virtualization/generic-odbc/mysql/mysql_version.sql @@ -0,0 +1,66 @@ +-- Create database scoped credential to connect to MySQL server +-- Provide appropriate credentials to MySQL server in below statement. +-- If you are using SQL Server Management Studio then you can replace the parameters using +-- the Query menu, and "Specify Values for Template Parameters" option. +IF NOT EXISTS(SELECT * FROM sys.database_scoped_credentials WHERE name = 'MySQL80-user') + CREATE DATABASE SCOPED CREDENTIAL [MySQL80-user] + WITH IDENTITY = 'mssql-user' + , SECRET = 'sql19tw0mysql'; + +-- Create external data source that points to MySQL server +-- The tokens '%u' and '%p' is used to reference the credential information. +-- +IF NOT EXISTS(SELECT * FROM sys.external_data_sources WHERE name = 'MySQL80') + CREATE EXTERNAL DATA SOURCE MySQL80 + WITH (LOCATION = 'odbc://uc-win19-vm.redmond.corp.microsoft.com' + , CONNECTION_OPTIONS = 'Driver={MySQL 8.0 ODBC Driver Unicode Driver};User name=%u;Passwword=%p' + , CREDENTIAL = [MySQL80-user]); + +-- Create external table over inventory table on MySQL server +-- +IF NOT EXISTS(SELECT * FROM sys.external_tables WHERE name = 'mysql_version') + CREATE EXTERNAL TABLE mysql_version + ( + [sys_version] NVARCHAR(5) NOT NULL, + [mysql_version] NVARCHAR(6) NOT NULL + ) + WITH (LOCATION = 'sys.version', DATA_SOURCE = MySQL80); + +SELECT * FROM mysql_version; + +/* +IF NOT EXISTS(SELECT * FROM sys.external_tables WHERE name = 'mysql_tables') + CREATE EXTERNAL TABLE mysql_tables + ( + TABLE_CATALOG nvarchar(64), + TABLE_SCHEMA nvarchar(64), + TABLE_NAME nvarchar(64), + TABLE_TYPE nvarchar(64), + ENGINE nvarchar(64), + VERSION smallint, + ROW_FORMAT nvarchar(64), + TABLE_ROWS bigint, + AVG_ROW_LENGTH bigint, + DATA_LENGTH bigint, + MAX_DATA_LENGTH bigint, + INDEX_LENGTH bigint, + DATA_FREE bigint, + AUTO_INCREMENT bigint, + CREATE_TIME datetime2, + UPDATE_TIME datetime2, + CHECK_TIME datetime2, + TABLE_COLLATION nvarchar(64), + CHECKSUM bigint, + CREATE_OPTIONS nvarchar(256), + TABLE_COMMENT nvarchar(256) + ) + WITH (LOCATION = 'information_schema.tables', DATA_SOURCE = MySQL80); + +SELECT * FROM mysql_tables; +*/ +-- Cleanup +/* +DROP EXTERNAL TABLE mysql_tables +DROP EXTERNAL DATA SOURCE MySQL80 +DROP DATABASE SCOPED CREDENTIAL [MySQL80-user] +*/ diff --git a/samples/features/sql-big-data-cluster/data-virtualization/generic-odbc/postgresql/pg_tables.sql b/samples/features/sql-big-data-cluster/data-virtualization/generic-odbc/postgresql/pg_tables.sql new file mode 100644 index 00000000..75e7827f --- /dev/null +++ b/samples/features/sql-big-data-cluster/data-virtualization/generic-odbc/postgresql/pg_tables.sql @@ -0,0 +1,42 @@ +-- Create database scoped credential to connect to PostgreSQL server +-- Provide appropriate credentials to PostgreSQL server in below statement. +-- If you are using SQL Server Management Studio then you can replace the parameters using +-- the Query menu, and "Specify Values for Template Parameters" option. +IF NOT EXISTS(SELECT * FROM sys.database_scoped_credentials WHERE name = 'PostgreSQL11-user') + CREATE DATABASE SCOPED CREDENTIAL [PostgreSQL11-user] + WITH IDENTITY = '' + , SECRET = ''; + +-- Create external data source that points to PostgreSQL server +-- The tokens '%u' and '%p' is used to reference the credential information. +-- +IF NOT EXISTS(SELECT * FROM sys.external_data_sources WHERE name = 'PostgreSQL11') + CREATE EXTERNAL DATA SOURCE PostgreSQL11 + WITH (LOCATION = 'odbc://' + , CONNECTION_OPTIONS = 'Driver={PostgreSQL ODBC Driver(UNICODE)};User name=%u;Passwword=%p' + , CREDENTIAL = [PostgreSQL11-user]); + +-- Create external table over inventory table on PostgreSQL server +-- +IF NOT EXISTS(SELECT * FROM sys.external_tables WHERE name = 'pg_tables') + CREATE EXTERNAL TABLE pg_tables + ( + schemaname nvarchar(128) not null, + tablename nvarchar(128) not null, + tableowner nvarchar(128) not null, + tablespace nvarchar(128) not null, + hasindexes nvarchar(5) not null, + hasrules nvarchar(5) not null, + hastriggers nvarchar(5) not null, + rowsecurity nvarchar(5) not null + ) + WITH (LOCATION = 'postgres.pg_catalog.pg_tables', DATA_SOURCE = PostgreSQL11); + +SELECT * FROM pg_tables; + +-- Cleanup +/* +DROP EXTERNAL TABLE pg_tables +DROP EXTERNAL DATA SOURCE PostgreSQL11 +DROP DATABASE SCOPED CREDENTIAL [PostgreSQL11-user] +*/ diff --git a/samples/features/sql-big-data-cluster/deployment/kubeadm/ubuntu/setup-k8s-master.sh b/samples/features/sql-big-data-cluster/deployment/kubeadm/ubuntu/setup-k8s-master.sh index c018cba6..6ebceb86 100644 --- a/samples/features/sql-big-data-cluster/deployment/kubeadm/ubuntu/setup-k8s-master.sh +++ b/samples/features/sql-big-data-cluster/deployment/kubeadm/ubuntu/setup-k8s-master.sh @@ -2,7 +2,7 @@ # Initialize a kubernetes cluster on the current node. # -KUBE_VERSION=1.13.4 +KUBE_VERSION=1.14.0 sudo kubeadm init --pod-network-cidr=10.244.0.0/16 --kubernetes-version=$KUBE_VERSION mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config diff --git a/samples/features/sql-big-data-cluster/deployment/kubeadm/ubuntu/setup-k8s-prereqs.sh b/samples/features/sql-big-data-cluster/deployment/kubeadm/ubuntu/setup-k8s-prereqs.sh index 0e1adae7..d3576ba7 100644 --- a/samples/features/sql-big-data-cluster/deployment/kubeadm/ubuntu/setup-k8s-prereqs.sh +++ b/samples/features/sql-big-data-cluster/deployment/kubeadm/ubuntu/setup-k8s-prereqs.sh @@ -10,7 +10,7 @@ cat </etc/apt/sources.list.d/kubernetes.list deb http://apt.kubernetes.io/ kubernetes-xenial main EOF -KUBE_DPKG_VERSION=1.13.4-00 +KUBE_DPKG_VERSION=1.14.0-00 apt-get update apt-get install -y ebtables ethtool apt-get install -y docker.io