-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add strftime to SQL features #4
Conversation
wendy-aw
commented
Jun 7, 2024
- added strftime feature for sqlite
- modified current_date_time_expressions to include CurrentDatetime
- added dialect to sqlglot parsing
- realized "now" is not always an anonymous expression, so added a line for that
- modified current_date_time_expressions - added dialect to sqlglot parsing
@@ -293,7 +296,7 @@ def get_sql_features( | |||
if " ~ '" in sql: | |||
sql = sql.replace(" ~ '", " LIKE '") | |||
sql = re.sub("character varying", "varchar", sql, flags=re.IGNORECASE) | |||
parsed = parse_one(sql) | |||
parsed = parse_one(sql, dialect) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for this - thanks!
@@ -385,6 +388,8 @@ def get_sql_features( | |||
features.rank = True | |||
elif isinstance(node, exp.DateTrunc): | |||
features.date_trunc = True | |||
elif isinstance(node, exp.TimeToStr): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for porting these over!