Skip to content

Commit

Permalink
Merge pull request #187 from Insight-Services-APAC/Feature-Issue169LH…
Browse files Browse the repository at this point in the history
…NameCheck_JM

Feature issue169 lh name check jm
  • Loading branch information
jrampono authored Nov 29, 2024
2 parents 957a471 + f1bac08 commit ff1b13f
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
21 changes: 18 additions & 3 deletions dbt_wrapper/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
from rich import print
from rich.panel import Panel



class Commands:
def __init__(self, console):
self.console = console
Expand All @@ -31,6 +29,12 @@ def __init__(self, console):
self.next_env = None
self.next_env_name = None

def CheckLakehouseLowercase(self, name):
if any(char.isupper() for char in name):
return 1
else:
return 0

def GetDbtConfigs(self, dbt_project_dir, dbt_profiles_dir=None, source_env=None, target_env=None):
if len(dbt_project_dir.replace("\\", "/").split("/")) > 1:
self.console.print(
Expand Down Expand Up @@ -58,6 +62,12 @@ def GetDbtConfigs(self, dbt_project_dir, dbt_profiles_dir=None, source_env=None,
self.profile_info = self.profile[self.config['profile']]
self.target_info = self.profile_info['outputs'][self.profile_info['target']]
self.lakehouse = self.target_info['lakehouse']

if "log_lakehouse" in self.target_info.keys():
self.log_lakehouse_check = self.target_info['log_lakehouse']
else:
self.log_lakehouse_check = None

if "sql_endpoint" in self.target_info.keys():
self.sql_endpoint = self.target_info['sql_endpoint']
else:
Expand All @@ -84,7 +94,12 @@ def GetDbtConfigs(self, dbt_project_dir, dbt_profiles_dir=None, source_env=None,
except:
raise Exception("No target environment setting found in profile.yml")


if self.CheckLakehouseLowercase(name=self.lakehouse) == 1:
raise Exception("Error: :The lakehouse name should only consist of lowercase letters, numbers, and underscores.")

if self.log_lakehouse_check is not None:
if self.CheckLakehouseLowercase(name=self.log_lakehouse_check) == 1:
raise Exception("Error: :The log lakehouse name should only consist of lowercase letters, numbers, and underscores.")

def PrintFirstTimeRunningMessage(self):
print('\033[1;33;48m', "Error!")
Expand Down
5 changes: 5 additions & 0 deletions docs/developer_guide/framework_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ Here we will create a new dbt project and configure it to use the dbt-fabricspar
3. From these properties select copy url and paste it into a text editor. The workspace id is the first GUID in the URL, the lakehouse id is the second GUID in the URL.
4. In the example below, the workspace id is `4f0cb887-047a-48a1-98c3-ebdb38c784c2` and the lakehouse id is `aa2e5f92-53cc-4ab3-9a54-a6e5b1aeb9a9`.

!!! Important

When editing the profiles file the ==lakehouse name== and ==log lakehouse== properties must not contain any uppercase characters. ==Lakehouse names== should only consist of lowercase letters, numbers, and underscores.


> https://onelake.dfs.fabric.microsoft.com/4f0cb887-047a-48a1-98c3-ebdb38c784c2/aa2e5f92-53cc-4ab3-9a54-a6e5b1aeb9a9/Files/notebooks

Expand Down
5 changes: 5 additions & 0 deletions docs/user_guide/dbt_project_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ Next we will create a new dbt project and configure it to use the dbt-fabricspar
3. From these properties select copy url and paste it into a text editor. The ==workspace id== is the first GUID in the URL, the ==lakehouse id== is the second GUID in the URL.
4. In the example below, the workspace id is `4f0cb887-047a-48a1-98c3-ebdb38c784c2` and the lakehouse id is `aa2e5f92-53cc-4ab3-9a54-a6e5b1aeb9a9`.

!!! Important

When editing the profiles file the ==lakehouse name== and ==log lakehouse== properties must not contain any uppercase characters. ==Lakehouse names== should only consist of lowercase letters, numbers, and underscores.


```plaintext title="Example URL"
https://onelake.dfs.fabric.microsoft.com/4f0cb887-047a-48a1-98c3-ebdb38c784c2/aa2e5f92-53cc-4ab3-9a54-a6e5b1aeb9a9/Files/notebooks
```
Expand Down

0 comments on commit ff1b13f

Please sign in to comment.