-
Notifications
You must be signed in to change notification settings - Fork 119
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
Use builtin timestampadd and timestampdiff functions for dateadd/datediff macros if available. #185
Conversation
…diff macros if available.
@@ -59,6 +60,19 @@ class DatabricksAdapter(SparkAdapter): | |||
|
|||
AdapterSpecificConfigs = DatabricksConfig | |||
|
|||
@available.parse(lambda *a, **k: 0) |
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.
Just curious, why do we need this @available.parse
?
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.
Methods to be exposed to macros need to be marked with @available
or its variants.
And without @available.parse
, the function will be executed even at parse time that causes InvalidConnectionException
because connections are not available at parse time.
A decorator factory to indicate that a method on the adapter will be
exposed to the database wrapper, and will be stubbed out at parse time
with the given function.
Thanks! merging. |
Description
Uses builtin
timestampadd
andtimestampdiff
functions fordateadd
/datediff
macros if available.The functions timestampadd and timestampdiff have been available since DBR 10.4. Those are equivalent to what
dateadd
/datediff
macros are trying to achieve.