Skip to content

Commit

Permalink
fix: custom algo string is not working (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
datnguye authored May 17, 2024
1 parent 12dd28d commit 4913b61
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 102 deletions.
7 changes: 4 additions & 3 deletions dbterd/adapters/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ def load_algo(name: str):
Returns:
ModuleType: Imported module
"""
module_name = name.split(":")[0]
try:
return import_module(name=f".{name}", package="dbterd.adapters.algos")
return import_module(name=f".{module_name}", package="dbterd.adapters.algos")
except ModuleNotFoundError as exc:
if exc.name == "dbterd.adapters.algos." + name:
raise Exception(f"Could not find adapter algo {name}!")
if exc.name == "dbterd.adapters.algos." + module_name:
raise Exception(f"Could not find adapter algo {module_name}!")
raise # pragma: no cover
Loading

0 comments on commit 4913b61

Please sign in to comment.