Skip to content

Commit b0af59f

Browse files
SireInsectusSireInsectus
authored andcommitted
Publishing v1.7.0
1 parent 8ef3294 commit b0af59f

File tree

2 files changed

+12
-20
lines changed

2 files changed

+12
-20
lines changed

Apache-Spark-Programming-with-Databricks/Includes/Common-Notebooks/Student-Environment.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,21 @@
4646
# MAGIC
4747
# MAGIC def getWorkingDir() -> str:
4848
# MAGIC import re
49-
# MAGIC langType = "p" # for python
5049
# MAGIC lessonName = re.sub("[^a-zA-Z0-9]", "_", getLessonName())
5150
# MAGIC moduleName = re.sub(r"[^a-zA-Z0-9]", "_", getModuleName())
5251
# MAGIC userhome = getUserhome()
53-
# MAGIC return f"{userhome}/{moduleName}/{lessonName}/{langType}".replace("__", "_").replace("__", "_").replace("__", "_").replace("__", "_").lower()
52+
# MAGIC return f"{userhome}/dbacademy/{moduleName}/{lessonName}/".replace("__", "_").replace("__", "_").replace("__", "_").replace("__", "_").lower()
5453
# MAGIC
5554
# MAGIC ############################################
5655
# MAGIC # USER DATABASE FUNCTIONS
5756
# MAGIC ############################################
5857
# MAGIC
5958
# MAGIC def getDatabaseName(username:str, moduleName:str, lessonName:str) -> str:
6059
# MAGIC import re
61-
# MAGIC user = re.sub("[^a-zA-Z0-9]", "", username)
60+
# MAGIC user = re.sub("[^a-zA-Z0-9]", "_", username)
6261
# MAGIC module = re.sub("[^a-zA-Z0-9]", "_", moduleName)
6362
# MAGIC lesson = re.sub("[^a-zA-Z0-9]", "_", lessonName)
64-
# MAGIC langType = "py" # for python
65-
# MAGIC databaseName = f"{user}_{module}_{lesson}_{langType}".lower()
63+
# MAGIC databaseName = f"dbacademy_{user}_{module}_{lesson}".replace("__", "_").replace("__", "_").replace("__", "_").replace("__", "_").lower()
6664
# MAGIC return databaseName
6765
# MAGIC
6866
# MAGIC
@@ -236,23 +234,21 @@
236234
# MAGIC }
237235
# MAGIC
238236
# MAGIC def getWorkingDir(): String = {
239-
# MAGIC val langType = "s" // for scala
240237
# MAGIC val lessonName = getLessonName().replaceAll("[^a-zA-Z0-9]", "_")
241238
# MAGIC val moduleName = getModuleName().replaceAll("[^a-zA-Z0-9]", "_")
242239
# MAGIC val userhome = getUserhome()
243-
# MAGIC return f"${userhome}/${moduleName}/${lessonName}/${langType}".replace("__", "_").replace("__", "_").replace("__", "_").replace("__", "_").toLowerCase()
240+
# MAGIC return f"${userhome}/dbacademy/${moduleName}/${lessonName}".replace("__", "_").replace("__", "_").replace("__", "_").replace("__", "_").toLowerCase()
244241
# MAGIC }
245242
# MAGIC
246243
# MAGIC //**********************************
247244
# MAGIC // USER DATABASE FUNCTIONS
248245
# MAGIC //**********************************
249246
# MAGIC
250247
# MAGIC def getDatabaseName(username:String, moduleName:String, lessonName:String):String = {
251-
# MAGIC val user = username.replaceAll("[^a-zA-Z0-9]", "")
248+
# MAGIC val user = username.replaceAll("[^a-zA-Z0-9]", "_")
252249
# MAGIC val module = moduleName.replaceAll("[^a-zA-Z0-9]", "_")
253250
# MAGIC val lesson = lessonName.replaceAll("[^a-zA-Z0-9]", "_")
254-
# MAGIC val langType = "scala" // for scala
255-
# MAGIC val databaseName = f"${user}_${module}_${lesson}_${langType}".toLowerCase
251+
# MAGIC val databaseName = f"dbacademy_${user}_${module}_${lesson}".toLowerCase
256252
# MAGIC return databaseName
257253
# MAGIC }
258254
# MAGIC

Apache-Spark-Programming-with-Databricks/Solutions/Includes/Common-Notebooks/Student-Environment.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,21 @@
4646
# MAGIC
4747
# MAGIC def getWorkingDir() -> str:
4848
# MAGIC import re
49-
# MAGIC langType = "p" # for python
5049
# MAGIC lessonName = re.sub("[^a-zA-Z0-9]", "_", getLessonName())
5150
# MAGIC moduleName = re.sub(r"[^a-zA-Z0-9]", "_", getModuleName())
5251
# MAGIC userhome = getUserhome()
53-
# MAGIC return f"{userhome}/{moduleName}/{lessonName}/{langType}".replace("__", "_").replace("__", "_").replace("__", "_").replace("__", "_").lower()
52+
# MAGIC return f"{userhome}/dbacademy/{moduleName}/{lessonName}/".replace("__", "_").replace("__", "_").replace("__", "_").replace("__", "_").lower()
5453
# MAGIC
5554
# MAGIC ############################################
5655
# MAGIC # USER DATABASE FUNCTIONS
5756
# MAGIC ############################################
5857
# MAGIC
5958
# MAGIC def getDatabaseName(username:str, moduleName:str, lessonName:str) -> str:
6059
# MAGIC import re
61-
# MAGIC user = re.sub("[^a-zA-Z0-9]", "", username)
60+
# MAGIC user = re.sub("[^a-zA-Z0-9]", "_", username)
6261
# MAGIC module = re.sub("[^a-zA-Z0-9]", "_", moduleName)
6362
# MAGIC lesson = re.sub("[^a-zA-Z0-9]", "_", lessonName)
64-
# MAGIC langType = "py" # for python
65-
# MAGIC databaseName = f"{user}_{module}_{lesson}_{langType}".lower()
63+
# MAGIC databaseName = f"dbacademy_{user}_{module}_{lesson}".replace("__", "_").replace("__", "_").replace("__", "_").replace("__", "_").lower()
6664
# MAGIC return databaseName
6765
# MAGIC
6866
# MAGIC
@@ -236,23 +234,21 @@
236234
# MAGIC }
237235
# MAGIC
238236
# MAGIC def getWorkingDir(): String = {
239-
# MAGIC val langType = "s" // for scala
240237
# MAGIC val lessonName = getLessonName().replaceAll("[^a-zA-Z0-9]", "_")
241238
# MAGIC val moduleName = getModuleName().replaceAll("[^a-zA-Z0-9]", "_")
242239
# MAGIC val userhome = getUserhome()
243-
# MAGIC return f"${userhome}/${moduleName}/${lessonName}/${langType}".replace("__", "_").replace("__", "_").replace("__", "_").replace("__", "_").toLowerCase()
240+
# MAGIC return f"${userhome}/dbacademy/${moduleName}/${lessonName}".replace("__", "_").replace("__", "_").replace("__", "_").replace("__", "_").toLowerCase()
244241
# MAGIC }
245242
# MAGIC
246243
# MAGIC //**********************************
247244
# MAGIC // USER DATABASE FUNCTIONS
248245
# MAGIC //**********************************
249246
# MAGIC
250247
# MAGIC def getDatabaseName(username:String, moduleName:String, lessonName:String):String = {
251-
# MAGIC val user = username.replaceAll("[^a-zA-Z0-9]", "")
248+
# MAGIC val user = username.replaceAll("[^a-zA-Z0-9]", "_")
252249
# MAGIC val module = moduleName.replaceAll("[^a-zA-Z0-9]", "_")
253250
# MAGIC val lesson = lessonName.replaceAll("[^a-zA-Z0-9]", "_")
254-
# MAGIC val langType = "scala" // for scala
255-
# MAGIC val databaseName = f"${user}_${module}_${lesson}_${langType}".toLowerCase
251+
# MAGIC val databaseName = f"dbacademy_${user}_${module}_${lesson}".toLowerCase
256252
# MAGIC return databaseName
257253
# MAGIC }
258254
# MAGIC

0 commit comments

Comments
 (0)