Skip to content

Commit

Permalink
fuzzy matching on column name for inheritance(snake_case to CamelCase)
Browse files Browse the repository at this point in the history
  • Loading branch information
syou6162 committed Aug 7, 2023
1 parent 2095a90 commit fb3e980
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/dbt_osmosis/core/osmosis.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import re
import json
from concurrent.futures import ThreadPoolExecutor, wait
from enum import Enum
Expand Down Expand Up @@ -982,7 +983,8 @@ def update_undocumented_columns_with_prior_knowledge(
inheritables = ("description", "tags", "meta")
changes_committed = 0
for column in undocumented_columns:
prior_knowledge = knowledge.get(column, False) or knowledge.get(column.lower(), False) or {}
camel_column = re.sub("_(.)", lambda m:m.group(1).upper(), column)
prior_knowledge = knowledge.get(column, False) or knowledge.get(column.lower(), False) or knowledge.get(camel_column, False) or {}
progenitor = prior_knowledge.pop("progenitor", "Unknown")
prior_knowledge = {k: v for k, v in prior_knowledge.items() if k in inheritables}
if not prior_knowledge:
Expand Down

0 comments on commit fb3e980

Please sign in to comment.