You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* remove --show-ui
* Update test_cli.py
* Exclude source models from expanded models in DbtColumnLineageExtractor
* lint
* logger
* Update utils.py
* remove verbose
* Enhance model matching logic to prioritize exact name matches and improve logging for multiple potential matches
* lint
* Improve logging for lineage extraction by adding warnings for skipped output generation when no matches or lineage information is found.
* self ref
* seff ref
* bump to 0.1.7b2
parser.add_argument('--manifest', default='./inputs/manifest.json', help='Path to the manifest.json file, default to ./inputs/manifest.json')
8
-
parser.add_argument('--catalog', default='./inputs/catalog.json', help='Path to the catalog.json file, default to ./inputs/catalog.json')
9
-
parser.add_argument('--dialect', default='snowflake', help='SQL dialect to use, default is snowflake, more dialects at https://github.com/tobymao/sqlglot/tree/v25.24.5/sqlglot/dialects')
10
8
parser.add_argument(
11
-
'--model',
12
-
nargs='*',
13
-
default=[],
14
-
help='''List of models to extract lineage for using dbt-style selectors:
9
+
"--manifest",
10
+
default="./inputs/manifest.json",
11
+
help="Path to the manifest.json file, default to ./inputs/manifest.json",
12
+
)
13
+
parser.add_argument(
14
+
"--catalog",
15
+
default="./inputs/catalog.json",
16
+
help="Path to the catalog.json file, default to ./inputs/catalog.json",
17
+
)
18
+
parser.add_argument(
19
+
"--dialect",
20
+
default="snowflake",
21
+
help="SQL dialect to use, default is snowflake, more dialects at https://github.com/tobymao/sqlglot/tree/v25.24.5/sqlglot/dialects",
22
+
)
23
+
parser.add_argument(
24
+
"--model",
25
+
nargs="*",
26
+
default=[],
27
+
help="""List of models to extract lineage for using dbt-style selectors:
15
28
- Simple model names: model_name
16
29
- Include ancestors: +model_name (include upstream/parent models)
17
30
- Include descendants: model_name+ (include downstream/child models)
@@ -20,15 +33,28 @@ def main():
20
33
- Tag filtering: tag:my_tag (models with specific tag)
21
34
- Path filtering: path:models/finance (models in specific path)
22
35
- Package filtering: package:my_package (models in specific package)
23
-
Default behavior extracts lineage for all models.'''
36
+
Default behavior extracts lineage for all models.""",
37
+
)
38
+
parser.add_argument(
39
+
"--model-list-json",
40
+
help="Path to a JSON file containing a list of models to extract lineage for. If specified, this takes precedence over --model",
41
+
)
42
+
parser.add_argument(
43
+
"--output-dir",
44
+
default="./outputs",
45
+
help="Directory to write output json files, default to ./outputs",
46
+
)
47
+
parser.add_argument(
48
+
"--continue-on-error",
49
+
action="store_true",
50
+
help="Continue processing even if some models fail",
24
51
)
25
-
parser.add_argument('--model-list-json', help='Path to a JSON file containing a list of models to extract lineage for. If specified, this takes precedence over --model')
26
-
parser.add_argument('--output-dir', default='./outputs', help='Directory to write output json files, default to ./outputs')
27
-
parser.add_argument('--show-ui', action='store_true', help='Flag to show lineage outputs in the console')
28
-
parser.add_argument('--continue-on-error', action='store_true', help='Continue processing even if some models fail')
29
52
30
53
args=parser.parse_args()
31
54
55
+
# Set up logging
56
+
logger=utils.setup_logging()
57
+
32
58
try:
33
59
selected_models=args.model
34
60
ifargs.model_list_json:
@@ -37,7 +63,7 @@ def main():
37
63
ifnotisinstance(selected_models, list):
38
64
raiseValueError("The JSON file must contain a list of model names")
39
65
exceptExceptionase:
40
-
print(f"Error reading model list from JSON file: {e}")
66
+
logger.error(f"Error reading model list from JSON file: {e}")
41
67
return1
42
68
43
69
extractor=DbtColumnLineageExtractor(
@@ -47,17 +73,19 @@ def main():
47
73
dialect=args.dialect,
48
74
)
49
75
50
-
print(f"Processing {len(extractor.selected_models)} models after selector expansion")
51
-
76
+
logger.info(f"Processing {len(extractor.selected_models)} models after selector expansion")
77
+
52
78
try:
53
79
lineage_map=extractor.build_lineage_map()
54
-
80
+
55
81
ifnotlineage_map:
56
-
print("Warning: No valid lineage was generated. Check for errors above.")
82
+
logger.warning("Warning: No valid lineage was generated. Check for errors above.")
0 commit comments