Skip to content

Commit

Permalink
fix sources with null databases (#306)
Browse files Browse the repository at this point in the history
  • Loading branch information
gouline authored Jan 10, 2025
1 parent c37cf49 commit 7a5425c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
4 changes: 2 additions & 2 deletions dbtmetabase/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def __init__(
self.include = self._norm_arg(include)
self.exclude = self._norm_arg(exclude)

def match(self, item: str) -> bool:
item = self._norm_item(item)
def match(self, item: Optional[str]) -> bool:
item = self._norm_item(item) if item else ""

for exclude in self.exclude:
if fnmatch.fnmatch(item, exclude):
Expand Down
11 changes: 9 additions & 2 deletions dbtmetabase/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
"caveats",
]

# Default model schema (only schema in BigQuery)
# Default values for non-standard sources
DEFAULT_DATABASE = ""
DEFAULT_SCHEMA = "PUBLIC"

# Foreign key constraint: "schema.model (column)" / "model (column)"
Expand Down Expand Up @@ -411,7 +412,13 @@ def ref(self) -> Optional[str]:

@property
def alias_path(self) -> str:
return ".".join([self.database, self.schema or DEFAULT_SCHEMA, self.alias])
return ".".join(
[
self.database or DEFAULT_DATABASE,
self.schema or DEFAULT_SCHEMA,
self.alias,
]
)

def format_description(
self,
Expand Down

0 comments on commit 7a5425c

Please sign in to comment.