Skip to content

Commit

Permalink
feat(metabase): add ability to exclude other users collections
Browse files Browse the repository at this point in the history
  • Loading branch information
paguos committed Apr 18, 2024
1 parent d3fb698 commit 8054f28
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions metadata-ingestion/docs/sources/metabase/metabase.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ the mapping between database id in Metabase and platform instance in DataHub may
```
The key in this map must be string, not integer although Metabase API provides `id` as number.
If `database_id_to_instance_map` is not specified, `platform_instance_map` is used for platform instance mapping. If none of the above are specified, platform instance is not used when constructing `urn` when searching for dataset relations.

If needed it is possible to exclude collections from other users by setting the following configuration:
```yaml
exclude_other_user_collections: true
```
## Compatibility

Metabase version [v0.48.3](https://www.metabase.com/start/oss/)
1 change: 1 addition & 0 deletions metadata-ingestion/docs/sources/metabase/metabase.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ source:
default_schema: public
database_alias_map:
h2: sample-dataset.db
exclude_other_user_collections: true
# Optional mapping of platform types to instance ids
platform_instance_map: # optional
postgres: test_postgres # optional
Expand Down
5 changes: 5 additions & 0 deletions metadata-ingestion/src/datahub/ingestion/source/metabase.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ class MetabaseConfig(DatasetLineageProviderConfigBase):
default="public",
description="Default schema name to use when schema is not provided in an SQL query",
)
exclude_other_user_collections: str = Field(
default="false",
description="Flag that if true, exclude other user collections",
)

@validator("connect_uri", "display_uri")
def remove_trailing_slash(cls, v):
Expand Down Expand Up @@ -209,6 +213,7 @@ def emit_dashboard_mces(self) -> Iterable[MetadataWorkUnit]:
try:
collections_response = self.session.get(
f"{self.config.connect_uri}/api/collection/"
f"?exclude-other-user-collections={self.config.exclude_other_user_collections}"
)
collections_response.raise_for_status()
collections = collections_response.json()
Expand Down

0 comments on commit 8054f28

Please sign in to comment.