Skip to content

Commit

Permalink
Merge pull request #79 from syou6162/fuzzy_matching_from_snake_to_camel
Browse files Browse the repository at this point in the history
Fuzzy matching on column name (from CamelCase to snake_case)
  • Loading branch information
z3z1ma authored Aug 11, 2023
2 parents b40f8d6 + fb3e980 commit 27325ab
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 @@ -992,7 +993,8 @@ def update_undocumented_columns_with_prior_knowledge(

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 27325ab

Please sign in to comment.