Skip to content
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

Add documentation about defining custom operators #779

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

nlassaux
Copy link

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!

Added a section dedicated to using a custom operator
Simplify the example
@nlassaux nlassaux requested a review from a team as a code owner December 10, 2023 12:26
@nlassaux nlassaux changed the title Doc extend operators Add documentation about defining custom operators Dec 10, 2023
@wd60622
Copy link
Contributor

wd60622 commented Dec 10, 2023

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 ?

Copy link

@AzisK AzisK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@AzisK
Copy link

AzisK commented Dec 10, 2023

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

@wd60622
Copy link
Contributor

wd60622 commented Dec 10, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants