-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature/gra-754-metabase-column-lineage (#589)
* Feat: Column level lineage for Metabase Questions.
- Loading branch information
Showing
16 changed files
with
917 additions
and
656 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
grai-integrations/source-metabase/src/grai_source_metabase/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
from grai_source_metabase import ( | ||
adapters, | ||
api, | ||
base, | ||
loader, | ||
mock_tools, | ||
models, | ||
package_definitions, | ||
) | ||
|
||
__version__ = "0.2.1" | ||
|
||
__version__ = "0.2.2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
110 changes: 110 additions & 0 deletions
110
grai-integrations/source-metabase/src/grai_source_metabase/api.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
from typing import Dict, List, Optional, Tuple | ||
|
||
from pydantic import BaseModel, Field, PrivateAttr | ||
|
||
|
||
class MetabaseDbmsVersion(BaseModel): | ||
flavor: str | ||
semantic_version: Optional[List] | ||
version: str | ||
|
||
|
||
class DB(BaseModel): | ||
dbms_version: Optional[MetabaseDbmsVersion] | ||
engine: Optional[str] | ||
id: int | ||
name: str | ||
timezone: Optional[str] | ||
|
||
|
||
class QuestionResultMetadata(BaseModel): | ||
# id: int | ||
base_type: str | ||
description: Optional[str] | ||
fingerprint: Optional[Dict] | ||
display_name: Optional[str] | ||
|
||
|
||
class QuestionDataSetQuery(BaseModel): | ||
database: int | ||
query: Optional[Dict] | ||
type: str | ||
|
||
|
||
class Question(BaseModel): | ||
id: int | ||
name: str | ||
table_id: Optional[int] | ||
database_id: Optional[int] | ||
collection_id: Optional[int] | ||
description: Optional[str] | ||
archived: Optional[bool] | ||
result_metadata: Optional[List[QuestionResultMetadata]] | ||
dataset_query: Optional[QuestionDataSetQuery] | ||
# ---- unvalidated ----# | ||
creator: Optional[Dict] | ||
public_uuid: Optional[str] | ||
collection: Optional[Dict] | ||
|
||
|
||
class TableDB(BaseModel): | ||
id: int | ||
name: str | ||
dbms_version: Optional[MetabaseDbmsVersion] | ||
engine: str | ||
|
||
|
||
class Table(BaseModel): | ||
id: int | ||
name: str | ||
active: Optional[bool] | ||
display_name: Optional[str] | ||
table_schema: str = Field(alias="schema") | ||
entity_type: Optional[str] | ||
db_id: int | ||
description: Optional[str] | ||
db: TableDB | ||
|
||
|
||
class FingerPrintGlobal(BaseModel): | ||
distinct_count: int = Field(..., alias="distinct-count") | ||
null_percent: float = Field(..., alias="nil%") | ||
|
||
class Config: | ||
allow_population_by_field_name = True | ||
|
||
|
||
class FingerPrint(BaseModel): | ||
global_stats: Optional[FingerPrintGlobal] = Field(alias="global") | ||
type_stats: Optional[Dict] = Field(alias="type") | ||
|
||
|
||
class TableMetadataField(BaseModel): | ||
id: int | ||
name: str | ||
display_name: str | ||
active: bool | ||
description: Optional[str] | ||
fingerprint: Optional[FingerPrint] | ||
|
||
|
||
class TableMetadata(BaseModel): | ||
id: int | ||
name: str | ||
table_schema: str = Field(..., alias="schema") | ||
active: bool | ||
db: Optional[TableDB] | ||
db_id: int | ||
display_name: str | ||
fields: Optional[List[TableMetadataField]] | ||
|
||
|
||
class Collection(BaseModel): | ||
name: str | ||
id: int | ||
parent_id: Optional[str] | ||
archived: Optional[bool] | ||
|
||
@property | ||
def full_name(self): | ||
return f"Collection: {self.name}" |
Oops, something went wrong.