Skip to content

Commit 72a63a9

Browse files
2 parents 506ac37 + c51eee2 commit 72a63a9

8 files changed

Lines changed: 161 additions & 3 deletions

File tree

samples/features/r-services/loan-classification/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Loan Classification using SQL Server 2016 R Services #
22

3-
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.
3+
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.
44

55
**Scripts**
66
* 1 - Create Database.sql - Creates the database, tables, stored procedures and other associated database objects required to get this sample going

samples/features/sql-big-data-cluster/bootstrap-sample-db.cmd

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ REM Copy the backup file, restore the database, create necessary objects and dat
3838
echo Copying sales database backup file to SQL Master instance...
3939
%DEBUG% kubectl cp tpcxbb_1gb.bak mssql-master-pool-0:/var/opt/mssql/data -c mssql-server -n %CLUSTER_NAMESPACE% || goto exit
4040

41+
REM Download and copy the sample backup files
4142
if /i %AW_WWI_SAMPLES% EQU --install-extra-samples (
4243
if NOT EXIST AdventureWorks2016_EXT.bak (
4344
echo Downloading AdventureWorks2016_EXT sample database backup file...
@@ -71,6 +72,10 @@ if /i %AW_WWI_SAMPLES% EQU --install-extra-samples (
7172
echo Configuring sample database(s)...
7273
%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
7374

75+
REM remove files copied into the pod:
76+
echo Removing database backup files...
77+
kubectl exec mssql-master-pool-0 -c mssql-server -i -t -- bash -c "rm -rvf /var/opt/mssql/data/*.bak"
78+
7479
for %%F in (web_clickstreams inventory customer) do (
7580
if NOT EXIST %%F.csv (
7681
echo Exporting %%F data...

samples/features/sql-big-data-cluster/bootstrap-sample-db.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ echo Configuring sample database...
7878
export SA_PASSWORD=$KNOX_PASSWORD
7979
$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)
8080

81+
# remove files copied into the pod:
82+
echo Removing database backup files...
83+
kubectl exec mssql-master-pool-0 -c mssql-server -i -t -- bash -c "rm -rvf /var/opt/mssql/data/*.bak"
84+
8185
for table in web_clickstreams inventory customer
8286
do
8387
echo Exporting $table data...
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Data virtualization in SQL Server 2019
2+
3+
***Applies to:*** SQL Server 2019 on Windows only
4+
5+
SQL Server 2019 introduces new ODBC connectors to data sources like SQL Server, Oracle, MongoDB and Teradata. The generic ODBC
6+
connector can also be used to connect to other data sources like PostgreSQL, MySQL, IBM DB2 or any data source that provides
7+
an ODBC driver. The ability to use the generic ODBC connector from SQL Server will be available only on Windows platform.
8+
9+
The steps to use the generic ODBC connector are:
10+
11+
1. Install the 64-bit ODBC Driver for the data source (ex: PostgreSQL, MySQL, IBM DB2, SAP HANA) on the SQL Server machine
12+
1. Installation of the ODBC driver should be done at the system level
13+
1. Use the Windows Control Panel ODBC applet (odbcad32) to determine the name of the ODBC Driver or refer to the ODBC Driver documentation
14+
15+
## Query data in PostgreSQL from SQL Server
16+
17+
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.
18+
19+
**Before you begin**, you need to have the PostgreSQL instance name and credentials
20+
21+
### Instructions
22+
23+
1. Connect to a SQL Server 2019 Windows instance and database.
24+
25+
1. Modify the parameters in [postgresql/pg_tables.sql](postgresql/pg_tables.sql/).
26+
27+
1. Execute the SQL [postgresql/pg_tables.sql](postgresql/pg_tables.sql/).
28+
29+
## Query data in MySQL from SQL Server
30+
31+
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.
32+
33+
**Before you begin**, you need to have the PostgreSQL instance name and credentials
34+
35+
### Instructions
36+
37+
1. Connect to a SQL Server 2019 Windows instance and database.
38+
39+
1. Modify the parameters in [mysql/mysql_version.sql](mysql/mysql_version.sql/).
40+
41+
1. Execute the SQL [mysql/mysql_version.sql](mysql/mysql_version.sql/).
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
-- Create database scoped credential to connect to MySQL server
2+
-- Provide appropriate credentials to MySQL server in below statement.
3+
-- If you are using SQL Server Management Studio then you can replace the parameters using
4+
-- the Query menu, and "Specify Values for Template Parameters" option.
5+
IF NOT EXISTS(SELECT * FROM sys.database_scoped_credentials WHERE name = 'MySQL80-user')
6+
CREATE DATABASE SCOPED CREDENTIAL [MySQL80-user]
7+
WITH IDENTITY = 'mssql-user'
8+
, SECRET = 'sql19tw0mysql';
9+
10+
-- Create external data source that points to MySQL server
11+
-- The tokens '%u' and '%p' is used to reference the credential information.
12+
--
13+
IF NOT EXISTS(SELECT * FROM sys.external_data_sources WHERE name = 'MySQL80')
14+
CREATE EXTERNAL DATA SOURCE MySQL80
15+
WITH (LOCATION = 'odbc://uc-win19-vm.redmond.corp.microsoft.com'
16+
, CONNECTION_OPTIONS = 'Driver={MySQL 8.0 ODBC Driver Unicode Driver};User name=%u;Passwword=%p'
17+
, CREDENTIAL = [MySQL80-user]);
18+
19+
-- Create external table over inventory table on MySQL server
20+
--
21+
IF NOT EXISTS(SELECT * FROM sys.external_tables WHERE name = 'mysql_version')
22+
CREATE EXTERNAL TABLE mysql_version
23+
(
24+
[sys_version] NVARCHAR(5) NOT NULL,
25+
[mysql_version] NVARCHAR(6) NOT NULL
26+
)
27+
WITH (LOCATION = 'sys.version', DATA_SOURCE = MySQL80);
28+
29+
SELECT * FROM mysql_version;
30+
31+
/*
32+
IF NOT EXISTS(SELECT * FROM sys.external_tables WHERE name = 'mysql_tables')
33+
CREATE EXTERNAL TABLE mysql_tables
34+
(
35+
TABLE_CATALOG nvarchar(64),
36+
TABLE_SCHEMA nvarchar(64),
37+
TABLE_NAME nvarchar(64),
38+
TABLE_TYPE nvarchar(64),
39+
ENGINE nvarchar(64),
40+
VERSION smallint,
41+
ROW_FORMAT nvarchar(64),
42+
TABLE_ROWS bigint,
43+
AVG_ROW_LENGTH bigint,
44+
DATA_LENGTH bigint,
45+
MAX_DATA_LENGTH bigint,
46+
INDEX_LENGTH bigint,
47+
DATA_FREE bigint,
48+
AUTO_INCREMENT bigint,
49+
CREATE_TIME datetime2,
50+
UPDATE_TIME datetime2,
51+
CHECK_TIME datetime2,
52+
TABLE_COLLATION nvarchar(64),
53+
CHECKSUM bigint,
54+
CREATE_OPTIONS nvarchar(256),
55+
TABLE_COMMENT nvarchar(256)
56+
)
57+
WITH (LOCATION = 'information_schema.tables', DATA_SOURCE = MySQL80);
58+
59+
SELECT * FROM mysql_tables;
60+
*/
61+
-- Cleanup
62+
/*
63+
DROP EXTERNAL TABLE mysql_tables
64+
DROP EXTERNAL DATA SOURCE MySQL80
65+
DROP DATABASE SCOPED CREDENTIAL [MySQL80-user]
66+
*/
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
-- Create database scoped credential to connect to PostgreSQL server
2+
-- Provide appropriate credentials to PostgreSQL server in below statement.
3+
-- If you are using SQL Server Management Studio then you can replace the parameters using
4+
-- the Query menu, and "Specify Values for Template Parameters" option.
5+
IF NOT EXISTS(SELECT * FROM sys.database_scoped_credentials WHERE name = 'PostgreSQL11-user')
6+
CREATE DATABASE SCOPED CREDENTIAL [PostgreSQL11-user]
7+
WITH IDENTITY = '<postgres_user,nvarchar(100),mssql-user>'
8+
, SECRET = '<postgres_user_password,nvarchar(100),sql19tw0postgresql>';
9+
10+
-- Create external data source that points to PostgreSQL server
11+
-- The tokens '%u' and '%p' is used to reference the credential information.
12+
--
13+
IF NOT EXISTS(SELECT * FROM sys.external_data_sources WHERE name = 'PostgreSQL11')
14+
CREATE EXTERNAL DATA SOURCE PostgreSQL11
15+
WITH (LOCATION = 'odbc://<postgres_server,nvarchar(100),postgres-server-name>'
16+
, CONNECTION_OPTIONS = 'Driver={PostgreSQL ODBC Driver(UNICODE)};User name=%u;Passwword=%p'
17+
, CREDENTIAL = [PostgreSQL11-user]);
18+
19+
-- Create external table over inventory table on PostgreSQL server
20+
--
21+
IF NOT EXISTS(SELECT * FROM sys.external_tables WHERE name = 'pg_tables')
22+
CREATE EXTERNAL TABLE pg_tables
23+
(
24+
schemaname nvarchar(128) not null,
25+
tablename nvarchar(128) not null,
26+
tableowner nvarchar(128) not null,
27+
tablespace nvarchar(128) not null,
28+
hasindexes nvarchar(5) not null,
29+
hasrules nvarchar(5) not null,
30+
hastriggers nvarchar(5) not null,
31+
rowsecurity nvarchar(5) not null
32+
)
33+
WITH (LOCATION = 'postgres.pg_catalog.pg_tables', DATA_SOURCE = PostgreSQL11);
34+
35+
SELECT * FROM pg_tables;
36+
37+
-- Cleanup
38+
/*
39+
DROP EXTERNAL TABLE pg_tables
40+
DROP EXTERNAL DATA SOURCE PostgreSQL11
41+
DROP DATABASE SCOPED CREDENTIAL [PostgreSQL11-user]
42+
*/

samples/features/sql-big-data-cluster/deployment/kubeadm/ubuntu/setup-k8s-master.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Initialize a kubernetes cluster on the current node.
44
#
5-
KUBE_VERSION=1.13.4
5+
KUBE_VERSION=1.14.0
66
sudo kubeadm init --pod-network-cidr=10.244.0.0/16 --kubernetes-version=$KUBE_VERSION
77
mkdir -p $HOME/.kube
88
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config

samples/features/sql-big-data-cluster/deployment/kubeadm/ubuntu/setup-k8s-prereqs.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
1010
deb http://apt.kubernetes.io/ kubernetes-xenial main
1111
EOF
1212

13-
KUBE_DPKG_VERSION=1.13.4-00
13+
KUBE_DPKG_VERSION=1.14.0-00
1414
apt-get update
1515
apt-get install -y ebtables ethtool
1616
apt-get install -y docker.io

0 commit comments

Comments
 (0)