Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix sources with null databases #306

Merged
merged 1 commit into from
Jan 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading