Skip to content

Commit 3f6a4e4

Browse files
authored
Merge pull request #649 from rajmera3/master
Update twitter streaming code to include defaults for hostname & port
2 parents 33ed142 + 9310550 commit 3f6a4e4

1 file changed

Lines changed: 26 additions & 6 deletions

File tree

samples/features/sql-big-data-cluster/spark/data-loading/spark-twitter-streaming-sample.ipynb

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"## **Steps**\r\n",
2525
"1. [Create a Twitter Developer Account](https://developer.twitter.com/en/apply-for-access.html).\r\n",
2626
"2. Setup\r\n",
27-
" 1. Create 'TwitterData' database.\r\n",
27+
" 1. Create 'TwitterData' database and retrieve server hostname.\r\n",
2828
" 2. Change kernel from \"SQL\" to \"Spark | Scala\".\r\n",
2929
" 3. Import packages.\r\n",
3030
" 4. Enter required parameters.\r\n",
@@ -53,7 +53,7 @@
5353
"cell_type": "markdown",
5454
"source": [
5555
"## **2. Setup**\n",
56-
"1. Create a database in the SQL Server master instance called 'TwitterData'.\n",
56+
"1. Create a database in the SQL Server master instance called 'TwitterData', and retrieve server hostname. \n",
5757
"2. Change the Kernel from \"SQL\" to \"Spark | Scala\".\n",
5858
"3. Import Java packages.\n",
5959
"4. Specify setup parameters"
@@ -65,7 +65,7 @@
6565
{
6666
"cell_type": "markdown",
6767
"source": [
68-
"### **2.1 Create TwitterData Database**"
68+
"### **2.1 Create TwitterData Database and Retrieve Hostname**"
6969
],
7070
"metadata": {
7171
"azdata_cell_guid": "196dd8cd-e4d7-45c7-b6f8-21dde6c75ae7"
@@ -89,6 +89,26 @@
8989
"outputs": [],
9090
"execution_count": 0
9191
},
92+
{
93+
"cell_type": "markdown",
94+
"source": [
95+
"Use the following cell to check your server name. If it returns ```master-0```, your hostname will be ```master-0.master-svc```. You will define this value in the Parameters section."
96+
],
97+
"metadata": {
98+
"azdata_cell_guid": "02e6cd9a-ef88-419c-afa0-e6a666f1070e"
99+
}
100+
},
101+
{
102+
"cell_type": "code",
103+
"source": [
104+
"SELECT @@Servername;"
105+
],
106+
"metadata": {
107+
"azdata_cell_guid": "0827942d-a223-4ba8-8168-2fb57a4a2488"
108+
},
109+
"outputs": [],
110+
"execution_count": 0
111+
},
92112
{
93113
"cell_type": "markdown",
94114
"source": [
@@ -141,7 +161,7 @@
141161
"### **2.4 Parameters**\r\n",
142162
"Enter the required parameters for the Spark streaming job to connect to SQL Server.\r\n",
143163
"\r\n",
144-
"In this example, the connection is made from Spark to the SQL Server master instance using the internal DNS name (master-9.master-svc) and port (1433). Alternatively, and especially if you are using a highly available Always On Availability Group, you can connect to the Kubernetes service that exposes the primary node of the Always On Availability Group.\r\n",
164+
"In this example, the connection is made from Spark to the SQL Server master instance using the internal DNS name (Ex: master-0.master-svc) and port (1433). Alternatively, and especially if you are using a highly available Always On Availability Group, you can connect to the Kubernetes service that exposes the primary node of the Always On Availability Group.\r\n",
145165
"\r\n",
146166
"#### Parameters needed to create Twitter stream\r\n",
147167
"- Twitter API authentication keys\r\n",
@@ -178,8 +198,8 @@
178198
"val password = \"password\"\r\n",
179199
"\r\n",
180200
"// Spark-SQL connector parameters\r\n",
181-
"val hostname = \"\"\r\n",
182-
"val port = 0000\r\n",
201+
"val hostname = \"master-0.master-svc\"\r\n",
202+
"val port = 1433\r\n",
183203
"val database = \"TwitterData\"\r\n",
184204
"val url = s\"jdbc:sqlserver://${hostname}:${port};database=${database};user=${user};password=${password};\"\r\n",
185205
"val dbtable = \"Tweets\"\r\n",

0 commit comments

Comments
 (0)