-
Notifications
You must be signed in to change notification settings - Fork 605
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
feat: Add TRY_TO_TIMESTAMP for Snowflake back end support #8934
Comments
Thanks for opening an issue! Does |
Thanks, I am trying to make this a "try": Which would require a 3rd positional, like this: which returns with Ibis 8 and Snowflake,
I am moving to ibis from dplyr/dbplyr in R, so I may be overlooking something. |
Ah, so this is really a "try to parse and return NULL if the pattern doesn't match" function it seems. For now you should be able to use our builtin function support for this: @ibis.udf.scalar.builtin
def try_to_timestamp(input, fmt: str) -> dt.Timestamp:
... You can then call this function on an Ibis expression: t.mutate(ts=try_to_timestamp(_.startdatetimeutc, "YYYY-MM-DD HH24:MI:SS.FF")) |
This looks promising, but I am overlooking some piece of this puzzle. I modified the above as:
and get the error:
Tried searching for a similar example, but I am missing something... Thanks! |
Hm, you might need to write |
More generally, we could probably add a |
I have now gotten past the earlier issue. But when I try to use the scalar function:
I get:
|
You have to invoke the UDF as a function (we don't magically add methods to things). T012_DF_OCCURRENCES_0
.head()
.mutate(DT_STOP_UTC = try_to_timestamp(_.stopdatetimeUtc, "YYYY-MM-DD HH24:MI:SS.FF"),) |
Thanks so much for indulging me, this worked. I sincerely appreciate your help and this great project! |
Is your feature request related to a problem?
Failure when invalid data in a column with just to_timestamp
What is the motivation behind your request?
Simplify date conversion from messy data
Describe the solution you'd like
try_to_timestamp()
What version of ibis are you running?
ibis-framework 8.0.0
What backend(s) are you using, if any?
Snowflake
Code of Conduct
The text was updated successfully, but these errors were encountered: