Skip to content

Commit

Permalink
Merge pull request #59 from rlsalcido24/yeardateformat
Browse files Browse the repository at this point in the history
year date format
  • Loading branch information
techvaquero authored Apr 2, 2024
2 parents 185619f + 60d6890 commit c9c0a1b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions helper/_resources/config/redshift/syntax_mappings.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@
"customnoposix" : {"source_pattern": "!~",
"target_pattern": "not rlike"
},
"tocharlower" : {"source_pattern": "to_char\\([^)]*?\\)",
"target_pattern": "to_char(#arg0, lower(#arg1))"
"yearformat" : {"source_pattern": "YYYY-",
"target_pattern": "yyyy-"
},
"getdate_to_df" : {"source_pattern": "getdate\\(\\)",
"target_pattern": "date_format(date_trunc('second', current_timestamp()), 'yyyy-MM-dd HH:mm:ss')"
Expand Down
7 changes: 6 additions & 1 deletion helper/convert_to_databricks.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,12 @@ def convert_syntax_expressions(content: str, source_pattern: str, target_pattern
elif target_pattern == "not rlike":
encontrar = re.findall(source_pattern, content, flags= re.DOTALL | re.IGNORECASE)
num_matches = len(encontrar)
updated_content = re.sub(source_pattern, target_pattern, content, flags= re.DOTALL | re.IGNORECASE)
updated_content = re.sub(source_pattern, target_pattern, content, flags= re.DOTALL | re.IGNORECASE)

elif target_pattern == "yyyy-":
encontrar = re.findall(source_pattern, content)
num_matches = len(encontrar)
updated_content = re.sub(source_pattern, target_pattern, content)

else:
initargs = findargs(content, source_pattern)
Expand Down

0 comments on commit c9c0a1b

Please sign in to comment.