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

Use cases #124

Closed
richiverse opened this issue Jul 7, 2015 · 5 comments
Closed

Use cases #124

richiverse opened this issue Jul 7, 2015 · 5 comments

Comments

@richiverse
Copy link

Use Case 1 - record level validation:
Say I have 2 fields. "Amount" and "Calculation Type". Amount is always a float, however when calculation type is "Percent", Amount must be bounded from 0 to 100.

Use Case 2 - table level validation:
Say I have multiple records and after grouping certain fields, no duplication can be present.

Use case 3 - Multiple coercion functions:
I need to convert a value to string, and perform a couple of other functions before validation. Any tips here?

Appreciate your help! This is probably one of the coolest python projects I've seen in a while.

@manugarri
Copy link

+1

@funkyfuture
Copy link
Member

  1. http://docs.python-cerberus.org/en/latest/customize.html
  2. i don't understand the scenario
  3. Proposal: custom coerce-methods #102

@manugarri, can you please elaborate?

@richiverse
Copy link
Author

@funkyfuture

For (2):
Say I had a column with 1000 rows and I want to say that all 1000 values in this column are in a table of 25000 rows, how would I do that in cerberus?

Or

How would I determine 1 or more columns in aggregate are unique?

@nicolaiarocci
Copy link
Member

Cerberus is only meant to validate one row against a set of rules. Not really designed for such an use case (which seems more suited for a relational database)

@richiverse
Copy link
Author

ok thx

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

No branches or pull requests

4 participants