Skip to content

Commit d30f9cc

Browse files
Modifying JS function (#377)
* Adding lab Ops Insights for HeatWave MySQL Adding lab Ops Insights for HeatWave MySQL * Modifying the last update by and date Modifying the last update by and date * Changing the estimated time and adding images for better understanding Changing the estimated time and adding images for better understanding * Updating file path * Modifying the estimated time and adding images for better understanding Modifying the estimated time and adding images for better understanding * Revert "Merge branch 'main' of https://github.com/SindhujaReddy-VT/em-omc" This reverts commit 68e75fd, reversing changes made to dbb3770. * Create jekyll-docker.yml * Adding lab MySQL connectors * Wording changes * Added Swagger UI to Test Rest Features Lab * Updated images * Modifing database name * Modified JS function
1 parent 6e5f475 commit d30f9cc

File tree

12 files changed

+53
-39
lines changed

12 files changed

+53
-39
lines changed

mysql/accelerate-app-development-with-low-code/b-lab-one-mysql-rest-service/mrs.md

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,11 @@ Estimated time: 30 minutes
183183
184184
![Started Local Instance](./images/started-local-instance.png " ")
185185
186-
15. Access the APIs using the URL **https://localhost:8445/HRService/HRDB/employee**.
186+
15. Access the APIs using the URL:
187187
188+
```
189+
<copy>https://localhost:8445/HRService/HRDB/employee</copy>
190+
```
188191
![Output](./images/chrome-output.png " ")
189192
190193
16. Adding a Primary Key value to the **request path (e.g. /1)** will filter the result to a single data set.
@@ -202,7 +205,11 @@ Adding offset and limit as query parameters allow you to page the full data set.
202205
203206
![Open API Window](./images/open-api-dialog.png " ")
204207
205-
3. After deployment completes access the Web UI. Open in your browser to launch OpenAPI Web UI, where you can test and explore the REST endpoints for your HR service **https://localhost:8445/myService/openApiUi/#/**.
208+
3. After deployment completes access the Web UI. Open in your browser to launch OpenAPI Web UI, where you can test and explore the REST endpoints for your HR service.
209+
210+
```
211+
<copy>https://localhost:8445/myService/openApiUi/#/</copy>
212+
```
206213
207214
![Swagger UI](./images/swagger-ui.png " ")
208215
@@ -229,7 +236,11 @@ Adding offset and limit as query parameters allow you to page the full data set.
229236
230237
![Swagger Post Response](./images/swagger-post-request.png " ")
231238
232-
9. After that check the output of **https://localhost:8445/HRService/HRDB/employee** on the other chrome tab to see the new employee added in the list.
239+
9. After that check the output on the other chrome tab to see the new employee added in the list.
240+
241+
```
242+
<copy>https://localhost:8445/HRService/HRDB/employee</copy>
243+
```
233244
234245
![Chrome Output](./images/chrome-post.png " ")
235246
@@ -241,7 +252,11 @@ Adding offset and limit as query parameters allow you to page the full data set.
241252
242253
![Swagger Delete Response](./images/swagger-delete-request.png " ")
243254
244-
12. After that check the output of **https://localhost:8445/HRService/HRDB/employee** on the other chrome tab where the deleted record should no longer appear in the list.
255+
12. After that check the output on the other chrome tab where the deleted record should no longer appear in the list.
256+
257+
```
258+
<copy>https://localhost:8445/HRService/HRDB/employee</copy>
259+
```
245260
246261
![Chrome Output](./images/chrome-delete.png " ")
247262
@@ -253,7 +268,11 @@ Adding offset and limit as query parameters allow you to page the full data set.
253268
254269
![Swagger Put Response](./images/swagger-put-request.png " ")
255270
256-
15. After that check the output of **https://localhost:8445/HRService/HRDB/employee** on the other chrome tab to look for the updated details in the response.
271+
15. After that check the output on the other chrome tab to look for the updated details in the response.
272+
273+
```
274+
<copy>https://localhost:8445/HRService/HRDB/employee</copy>
275+
```
257276
258277
![Chrome Output](./images/chrome-put.png " ")
259278
@@ -263,6 +282,6 @@ Adding offset and limit as query parameters allow you to page the full data set.
263282
264283
## Acknowledgements
265284
266-
* **Author** - Sindhuja Banka, HeatWave MySQL Product Manager
285+
* **Author** - Sindhuja Banka, MySQL HeatWave Product Manager
267286
* **Contributors** - Sindhuja Banka, Anand Prabhu
268287
* **Last Updated By/Date** - Sindhuja Banka, August 2025
39.6 KB
Loading
-136 KB
Loading
-71.2 KB
Loading

mysql/accelerate-app-development-with-low-code/c-lab-two-javascript/javascript.md

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -103,71 +103,66 @@ MySQL-JavaScript unlocks new opportunities in application design that were once
103103
5. Execute the following procedure that calculates risk based on income and credit score, with JavaScript inside MySQL handling the maskung of PII fields for secure data processing.
104104
105105
```
106-
<copy>
107-
create PROCEDURE get_masked_customer_by_cif(IN cif_id int)
108-
LANGUAGE javascript as $$
106+
<copy>
107+
CREATE PROCEDURE `javascript_demo`.`get_masked_customer_by_cif`(IN cif_id int, OUT masked JSON)
108+
DETERMINISTIC LANGUAGE JAVASCRIPT
109+
AS $$
109110
let selectStatement = session.prepare(
110-
"SELECT * FROM cif_details where cif_id = ?"
111+
"SELECT * FROM cif_details where cif_id = ?"
111112
);
112113
let result = selectStatement.bind(cif_id).execute();
113114
let row = result.fetchOne();
114115
115116
if(!row){
116-
console.log("Error retrieving details");
117-
return {error: "No customer found."};
118-
}
117+
console.log("Error retrieving details");
118+
return {error: "No customer found."};
119+
}
119120
120121
const maskEmail = (email) => {
121122
if(!email || !email.includes('@')) return email;
122123
const [local, domain] = email.split('@');
123124
if(local.length<=2) return '*'.repeat(local.length) + '@' + domain;
124125
return local.slice(0,2) + '*'.repeat(local.length-2) + '@' + domain;
125-
};
126+
};
126127
127128
const maskPhone = (phone) => {
128129
if(!phone || phone.length<4) return email;
129130
return '*'.repeat(phone.length-4) + phone.slice(-4);
130-
};
131+
};
131132
132133
const maskSSN = (ssn) => {
133134
if(!ssn || ssn.length<4) return ssn;
134135
return '***-**-' + ssn.slice(-4);
135-
};
136+
};
136137
137-
let risk_flag = 'Low';
138+
let risk_flag = 'low';
138139
if (row.income < 50000 || row.credit_score < 600){
139-
risk_flag='High';
140+
risk_flag='high';
140141
} else if (row.credit_score < 700) {
141-
risk_flag = 'Medium';
142+
risk_flag = 'medium';
142143
}
143144
144-
console.log(">> PII Masked Record for CIF:", row[0])
145-
console.log(" Masked Email: ", maskEmail(row[2]))
146-
console.log(" Masked Phone: ", maskPhone(row[3]))
147-
console.log(" Masked SSN: ", maskSSN(row[5]))
148-
console.log(" Risk Status: ", risk_flag)
149-
150-
return {
145+
masked = {
151146
name: row[1],
152147
email: maskEmail(row[2]),
153148
phone: maskPhone(row[3]),
154-
dob: row[4],
155149
ssn: maskSSN(row[5]),
156150
income: row[6],
157151
credit_score: row[7],
158-
address: row[8],
159-
created_at: row[9]
152+
risk_status: risk_flag
160153
}
161154
$$;
162-
</copy>
155+
</copy>
163156
```
164157
![JS Stored Procedure](./images/js-stored-procedure.png " ")
165158
166159
6. Test the procedure call by calling it with a customer ID to retrieve customer data with masked PII fields and calculated risk based on income and credit score.
167160
168161
```
169162
<copy>
170-
CALL get_masked_customer_by_cif(1);</copy>
163+
CALL`javascript_demo`.`get_masked_customer_by_cif`(1, @out);
164+
SELECT @out;
165+
</copy>
171166
```
172167
![Call Stored Procedure](./images/call-procedure.png " ")
173168
@@ -255,6 +250,6 @@ MySQL-JavaScript unlocks new opportunities in application design that were once
255250
256251
## Acknowledgements
257252
258-
* **Author** - Sindhuja Banka, HeatWave MySQL Product Manager
253+
* **Author** - Sindhuja Banka, MySQL HeatWave Product Manager
259254
* **Contributors** - Sindhuja Banka, Anand Prabhu
260255
* **Last Updated By/Date** - Sindhuja Banka, July 2025

mysql/accelerate-app-development-with-low-code/d-lab-three-json-functions/json.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,6 @@ Estimated time: 10 minutes
104104
105105
## Acknowledgements
106106
107-
* **Author** - Sindhuja Banka, HeatWave MySQL Product Manager
107+
* **Author** - Sindhuja Banka, MySQL HeatWave Product Manager
108108
* **Contributors** - Sindhuja Banka, Anand Prabhu
109109
* **Last Updated By/Date** - Sindhuja Banka, July 2025

mysql/accelerate-app-development-with-low-code/e-lab-four-text-search/fulltextsearch.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,6 @@ AGAINST('+MySQL +JSON' IN BOOLEAN MODE);</copy>
9797
9898
## Acknowledgements
9999
100-
* **Author** - Sindhuja Banka, HeatWave MySQL Product Manager
100+
* **Author** - Sindhuja Banka, MySQL HeatWave Product Manager
101101
* **Contributors** - Sindhuja Banka, Anand Prabhu
102102
* **Last Updated By/Date** - Sindhuja Banka, July 2025

mysql/accelerate-app-development-with-low-code/f-lab-five-encryption-compression/encryptioncompression.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,6 @@ VALUES ('PolicyDoc', COMPRESS(REPEAT('This is a very large block of text. ', 50)
181181
182182
## Acknowledgements
183183
184-
* **Author** - Sindhuja Banka, HeatWave MySQL Product Manager
184+
* **Author** - Sindhuja Banka, MySQL HeatWave Product Manager
185185
* **Contributors** - Sindhuja Banka, Anand Prabhu
186186
* **Last Updated By/Date** - Sindhuja Banka, July 2025

mysql/accelerate-app-development-with-low-code/g-lab-six-connectors/connectors.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ By the end of this lab, you'll be able to:
4949
4. In VS Code’s terminal, run the following command and press Enter to install the necessary Python connector. This step prepares your Python environment to communicate with MySQL databases.
5050
5151
```
52-
<copy>pip install mysql-connector-python</copy>
52+
<copy>pip show mysql-connector-python</copy>
5353
```
54-
![Select Records](./images/pip-install-python.png " ")
54+
![Select Records](./images/pip-show-python.png " ")
5555
56-
5. After running the install command, check the terminal output for a message indicating that mysql-connector-python has been successfully installed. Look for lines like **Successfully installed mysql-connector-python** to confirm the installation completed without errors.
56+
5. After running the show command, check the terminal output for a message indicating that mysql-connector-python has been successfully retrieved.
5757
5858
![Select Statement](./images/python-installation.png " ")
5959
@@ -160,6 +160,6 @@ By the end of this lab, you'll be able to:
160160
161161
## Acknowledgements
162162
163-
* **Author** - Sindhuja Banka, HeatWave MySQL Product Manager
163+
* **Author** - Sindhuja Banka, MySQL HeatWave Product Manager
164164
* **Contributors** - Sindhuja Banka, Anand Prabhu
165165
* **Last Updated By/Date** - Sindhuja Banka, July 2025
Binary file not shown.

0 commit comments

Comments
 (0)