Skip to content
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

Merged
merged 4 commits into from
Jun 7, 2024
Merged

Add strftime to SQL features #4

merged 4 commits into from
Jun 7, 2024

Conversation

wendy-aw
Copy link
Contributor

@wendy-aw 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
@wendy-aw wendy-aw requested a review from wongjingping June 7, 2024 05:39
@@ -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)
Copy link
Member

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):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL!

Copy link
Contributor

@wongjingping wongjingping left a 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!

@wendy-aw wendy-aw merged commit 2738243 into main Jun 7, 2024
1 check passed
@wendy-aw wendy-aw deleted the wendy/sqlite_features branch June 7, 2024 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants