piccolo icon indicating copy to clipboard operation
piccolo copied to clipboard

Feature: Custom SQL Functions

Open cheesycod opened this issue 3 years ago • 6 comments

For example, postgres has the RANDOM() function. In order to replicate these sort of functions, it would be nice to have a Function type to allow custom queries and functions to be used in a order_by()

cheesycod avatar Sep 15 '22 16:09 cheesycod

Right now, you have to use raw sql for these operations

cheesycod avatar Sep 15 '22 16:09 cheesycod

You're right, this needs adding.

We have something similar called WhereRaw:

https://piccolo-orm.readthedocs.io/en/latest/piccolo/query_clauses/where.html#whereraw

We need to add SelectRaw.

dantownsend avatar Sep 15 '22 17:09 dantownsend

I just re-read this issue, and realised that you want to have custom SQL in the order by clause.

dantownsend avatar Sep 15 '22 21:09 dantownsend

Yea

cheesycod avatar Sep 21 '22 09:09 cheesycod

SelectRaw too would be nice

cheesycod avatar Sep 21 '22 09:09 cheesycod

But really it would be nice to have a Function type

cheesycod avatar Sep 21 '22 09:09 cheesycod

any updates?

cheesycod avatar Oct 01 '22 12:10 cheesycod

I just need to refactor my PR, so we also have RawOrder.

dantownsend avatar Oct 03 '22 09:10 dantownsend

Ah ok thanks

cheesycod avatar Oct 12 '22 17:10 cheesycod

Fixed in 0.97.0

dantownsend avatar Nov 22 '22 21:11 dantownsend