pypika icon indicating copy to clipboard operation
pypika copied to clipboard

Add documentation about defining custom operators

Open nlassaux opened this issue 1 year ago • 3 comments

Many extensions define new operators, for example to compute various distances between geometries, vectors, etc. A useful example is <-> being used by PostGIS.

Added the documentation explaining how to leverage ArithmeticExpression to extend pypika with it, right under the explanation about how to define a custom function. Having that doc section would have saved me quite some time actually.

Thanks @wd60622 for explaining the approach!

nlassaux avatar Dec 10 '23 12:12 nlassaux

Looks awesome. Thanks for making the adjustment

Only thing I would suggest is adding a brief section on this in the README like with the Custom Functions section

Any thoughts @AzisK ?

wd60622 avatar Dec 10 '23 14:12 wd60622

Thanks to both of you. I don't have any additional suggestions except writing a test to be sure that people actually can define their own custom operators

AzisK avatar Dec 10 '23 17:12 AzisK

Thanks to both of you. I don't have any additional suggestions except writing a test to be sure that people actually can define their own custom operators

Think that's fair. If someones going into the code base, I think ideally someone might be able to use a string instead of a small class.

wd60622 avatar Dec 10 '23 17:12 wd60622