You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature Request] Support native date.now function in standard library to reduce S-string usage #5720
Currently, many temporal functions, including date.now, are not natively supported in PRQL's standard library. To use them, users must resort to S-strings like s"now()" or s"CURRENT_TIMESTAMP".
While S-strings provide a powerful escape hatch, they have several drawbacks:
Poor Readability: They break the visual flow of PRQL code.
Maintenance: They make the query dialect-dependent, defeating one of PRQL's core strengths (abstraction over SQL dialects).
Developer Experience: Writing s"now()" feels less intuitive than a native function call.
Proposed Change
I propose adding a native date.now function to the PRQL standard library. This would allow users to write:
derive [
created_at = date.now
]
Instead of:
derive [
created_at = s"now()"
]
Implementation Idea
The date.now function can be added to the stdlib.prql and mapped to the appropriate SQL equivalent based on the target dialect (e.g., NOW() for PostgreSQL/MySQL, CURRENT_TIMESTAMP for others).
I am willing to contribute to this by implementing the date.now function in the standard library if the maintainers agree with this direction.
Additional Context
As PRQL matures, moving frequently used functions from S-strings to the standard library will significantly improve the overall user experience and type-safety potential.
changed the title [-][Feature Request] Support native now() function in standard library to reduce S-string usage[/-][+][Feature Request] Support native `now()` function in standard library to reduce S-string usage[/+]on Mar 20, 2026
@max-sixty
One more question. if I want to provide a function like argMax(val1, val2) in PRQL format, should I implement it to work as argMax val1 val2 (using spaces instead of parentheses and commas)?
changed the title [-][Feature Request] Support native `now()` function in standard library to reduce S-string usage[/-][+][Feature Request] Support native `date.now` function in standard library to reduce S-string usage[/+]on Mar 24, 2026
Activity
[-][Feature Request] Support native now() function in standard library to reduce S-string usage[/-][+][Feature Request] Support native `now()` function in standard library to reduce S-string usage[/+]max-sixty commentedon Mar 20, 2026
yes, very open to adding common functions like this. It would need to be in PRQL form (i.e. not
now())!sunyeongchoi commentedon Mar 20, 2026
@max-sixty
Does 'PRQL form' mean that I should use
nowinstead ofnow()? For example, providing it like this:instead of using parentheses?
max-sixty commentedon Mar 20, 2026
yes!
sunyeongchoi commentedon Mar 20, 2026
Thank you for confirming
sunyeongchoi commentedon Mar 20, 2026
@max-sixty
One more question. if I want to provide a function like
argMax(val1, val2)in PRQL format, should I implement it to work asargMax val1 val2(using spaces instead of parentheses and commas)?[-][Feature Request] Support native `now()` function in standard library to reduce S-string usage[/-][+][Feature Request] Support native `date.now` function in standard library to reduce S-string usage[/+]