Skip to content

Conversation

@guimorg
Copy link
Contributor

@guimorg guimorg commented Mar 15, 2025

  • Add Granularity and FilterOperators enums for better type checking and developer experience.
  • Extend model classes with additional fields like compare_date_range, logical operators for filters, and offset parameter for pagination.
  • Make values field optional in Filter class to support operators that don't require values.

@guimorg guimorg marked this pull request as draft March 15, 2025 00:14
@guimorg guimorg force-pushed the chore/perfect-models branch from 0b549db to cdad621 Compare March 15, 2025 00:26
@guimorg
Copy link
Contributor Author

guimorg commented Mar 15, 2025

This PR aims to bring a bit more semantic and allow for some validations to take place on the model.

Most of the model is based on the documentation provided by CubeJS here:

https://cube.dev/docs/product/apis-integrations/rest-api/query-format

But also on some historical queries we've already performed, for example order is documented as an array of tuples, but it also accepts a plain dict/Object/map.

@guimorg guimorg marked this pull request as ready for review March 15, 2025 00:27
@guimorg
Copy link
Contributor Author

guimorg commented Mar 15, 2025

I'm still unsure if leaving enums as the proposed by pylint is the best semantic or even visual queue. Maybe leaving it all as snake case, or camel cases. idk. I feel sometimes enums are just plainly yelling at me lol

@guimorg guimorg force-pushed the chore/perfect-models branch from cdad621 to 1758054 Compare March 15, 2025 00:54
- Add Granularity and FilterOperators enums for better type checking and
developer experience.
- Extend model classes with additional fields like compare_date_range,
logical operators for filters, and offset parameter for pagination.
- Make values field optional in Filter class to support operators that don't require values.
@guimorg guimorg force-pushed the chore/perfect-models branch from 1758054 to dc1809b Compare March 17, 2025 13:02
Copy link
Collaborator

@rafaelleinio rafaelleinio left a comment

Choose a reason for hiding this comment

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

lgtm! if you want to change the README.md example with the new enum definition, feel free to do that as well

@rafaelleinio
Copy link
Collaborator

I'm still unsure if leaving enums as the proposed by pylint is the best semantic or even visual queue. Maybe leaving it all as snake case, or camel cases. idk. I feel sometimes enums are just plainly yelling at me lol

Yeah, I feel the same, it's ugly IMO. But I think is a pattern already too common and followed by the python community.

@rafaelleinio rafaelleinio merged commit ce29472 into wandercom:main Mar 17, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants