Validators availables¶
At the moment, the library support this validations:
- Types
- Numeric
- Comparision
- Internet
- Location
- Financial
- ValidateCreditCard
- ValidateCurrency
- in_iban
- in_bic
- Others
ValidateInteger¶
Check if the new value is a valid int or long type
Parametes:
| Parameter | Default | Description |
|---|---|---|
| field | SQLAlchemy column to validate | |
| allow_null | True | Allow null values |
| throw_exception | False | Throw a ValidateError exception on validation fails |
| message | None | Add a custom message to the ValidateError exception |
Note
long type is only available i Python 2.7
ValidateNumeric¶
Check if the new value is a valid int, long, float or complex type
Parametes:
| Parameter | Default | Description |
|---|---|---|
| field | SQLAlchemy column to validate | |
| allow_null | True | Allow null values |
| throw_exception | False | Throw a ValidateError exception on validation fails |
| message | None | Add a custom message to the ValidateError exception |
Note
long type is only available i Python 2.7
ValidateString¶
Check if the new value is a valid string type.
Parametes:
| Parameter | Default | Description |
|---|---|---|
| field | SQLAlchemy column to validate | |
| allow_null | True | Allow null values |
| throw_exception | False | Throw a ValidateError exception on validation fails |
| message | None | Add a custom message to the ValidateError exception |
ValidateBoolean¶
Check if the new value is a valid bool type.
Parametes:
| Parameter | Default | Description |
|---|---|---|
| field | SQLAlchemy column to validate | |
| throw_exception | False | Throw a ValidateError exception on validation fails |
| message | None | Add a custom message to the ValidateError exception |
Validatelength¶
Check if the new value has a length with a maximun and a minimun
Parametes:
| Parameter | Default | Description |
|---|---|---|
| field | SQLAlchemy column to validate | |
| max_length | None | Maximum value length |
| min_length | 0 | Minumum value length |
| throw_exception | False | Throw a ValidateError exception on validation fails |
| message | None | Add a custom message to the ValidateError exception |
ValidateNumber¶
Check if the new value is a number or not (NaN)
Parametes:
| Parameter | Default | Description |
|---|---|---|
| field | SQLAlchemy column to validate | |
| throw_exception | False | Throw a ValidateError exception on validation fails |
| message | None | Add a custom message to the ValidateError exception |
ValidateLessThan¶
Check if the new value is a lesser than X value
Parametes:
| Parameter | Default | Description |
|---|---|---|
| field | SQLAlchemy column to validate | |
| value | Value to check | |
| throw_exception | False | Throw a ValidateError exception on validation fails |
| message | None | Add a custom message to the ValidateError exception |
ValidateLessThanOrEqual¶
Check if the new value is a lesser than X value or equal
Parametes:
| Parameter | Default | Description |
|---|---|---|
| field | SQLAlchemy column to validate | |
| value | Value to check | |
| throw_exception | False | Throw a ValidateError exception on validation fails |
| message | None | Add a custom message to the ValidateError exception |
ValidateGreaterThan¶
Check if the new value is a greater than X value
Parametes:
| Parameter | Default | Description |
|---|---|---|
| field | SQLAlchemy column to validate | |
| value | Value to check | |
| throw_exception | False | Throw a ValidateError exception on validation fails |
| message | None | Add a custom message to the ValidateError exception |
ValidateGreaterThanOrEqual¶
Check if the new value is a greater than X value or equal
Parametes:
| Parameter | Default | Description |
|---|---|---|
| field | SQLAlchemy column to validate | |
| value | Value to check | |
| throw_exception | False | Throw a ValidateError exception on validation fails |
| message | None | Add a custom message to the ValidateError exception |
ValidateEmail¶
Check if the new value is a valid e-mail, using email_validator library.
Parametes:
| Parameter | Default | Description |
|---|---|---|
| field | SQLAlchemy column to validate | |
| allow_smtputf8 | True | Allow internationalized addresses that would require the SMTPUTF8 extension. |
| check_deliverability | True | Check domain name resolution. |
| allow_empty_local | False | Allow an empty local part for validating Postfix aliases. |
| allow_null | True | Allow null values |
| throw_exception | False | Throw a ValidateError exception on validation fails |
| message | None | Add a custom message to the ValidateError exception |
ValidateRegex¶
Compare a value against a regular expresion
Parametes:
| Parameter | Default | Description |
|---|---|---|
| field | SQLAlchemy column to validate | |
| throw_exception | False | Throw a ValidateError exception on validation fails |
| message | None | Add a custom message to the ValidateError exception |
ValidateRange¶
Check if the new value is in a range
Parametes:
| Parameter | Default | Description |
|---|---|---|
| field | SQLAlchemy column to validate | |
| range | Range values | |
| allow_null | True | Allow null values |
| throw_exception | False | Throw a ValidateError exception on validation fails |
| message | None | Add a custom message to the ValidateError exception |
ValidateIP¶
Check if the value is a valid IP Address
Parametes:
| Parameter | Default | Description |
|---|---|---|
| field | SQLAlchemy column to validate | |
| ipv6 | False | Check IPv6 Address instread of IPv4 |
| allow_null | True | Allow null values |
| throw_exception | False | Throw a ValidateError exception on validation fails |
| message | None | Add a custom message to the ValidateError exception |
ValidateURL¶
Check if the value is a valid URL
Parametes:
| Parameter | Default | Description |
|---|---|---|
| field | SQLAlchemy column to validate | |
| allow_null | True | Allow null values |
| throw_exception | False | Throw a ValidateError exception on validation fails |
| message | None | Add a custom message to the ValidateError exception |
ValidateUUID¶
Check if the value is a valid UUUID
Parametes:
| Parameter | Default | Description |
|---|---|---|
| field | SQLAlchemy column to validate | |
| version | 4 | UUID version |
| allow_null | True | Allow null values |
| throw_exception | False | Throw a ValidateError exception on validation fails |
| message | None | Add a custom message to the ValidateError exception |
ValidateCountry¶
Check if the value is a valid Country. Validation provided by iso3166. Allowed names:
- Name
- Alpha2
- Alpha3
- Numeric
- Apolitic Name
Parametes:
| Parameter | Default | Description |
|---|---|---|
| field | SQLAlchemy column to validate | |
| allow_null | True | Allow null values |
| throw_exception | False | Throw a ValidateError exception on validation fails |
| message | None | Add a custom message to the ValidateError exception |
ValidateTimezone¶
Check if the value is a valid Timezone. Validation provided by pytz
Parametes:
| Parameter | Default | Description |
|---|---|---|
| field | SQLAlchemy column to validate | |
| allow_null | True | Allow null values |
| throw_exception | False | Throw a ValidateError exception on validation fails |
| message | None | Add a custom message to the ValidateError exception |
ValidateLocale¶
Check if the value is a valid Locale.
Parametes:
| Parameter | Default | Description |
|---|---|---|
| field | SQLAlchemy column to validate | |
| allow_null | True | Allow null values |
| throw_exception | False | Throw a ValidateError exception on validation fails |
| message | None | Add a custom message to the ValidateError exception |
ValidateCreditCard¶
Check if the new value is valid credit card number.
Allowed formats: * XXXXYYYYWWWWZZZ * “XXXXYYYYWWWWZZZ” * “XXXX YYYY WWWW ZZZ” * “XXXX-YYYY-WWWW-ZZZ”
Parametes:
| Parameter | Default | Description |
|---|---|---|
| field | SQLAlchemy column to validate | |
| allow_null | True | Allow null values |
| throw_exception | False | Throw a ValidateError exception on validation fails |
| message | None | Add a custom message to the ValidateError exception |
ValidateCurrency¶
Check if the new value is a valid Currency
Validation provided by: moneyed
Parametes:
| Parameter | Default | Description |
|---|---|---|
| field | SQLAlchemy column to validate | |
| allow_null | True | Allow null values |
| throw_exception | False | Throw a ValidateError exception on validation fails |
| message | None | Add a custom message to the ValidateError exception |
ValidateIBAN¶
Check if the new value is valid IBAN (International Bank Account Number)
More reference: https://en.wikipedia.org/wiki/International_Bank_Account_Number
Parametes:
| Parameter | Default | Description |
|---|---|---|
| field | SQLAlchemy column to validate | |
| allow_null | True | Allow null values |
| throw_exception | False | Throw a ValidateError exception on validation fails |
| message | None | Add a custom message to the ValidateError exception |
ValidateBIC¶
Check if the new value is valid BIC (SO 9362 defined standard format of Bank Identifier Codes )
More reference: https://en.wikipedia.org/wiki/ISO_9362
Parametes:
| Parameter | Default | Description |
|---|---|---|
| field | SQLAlchemy column to validate | |
| allow_null | True | Allow null values |
| throw_exception | False | Throw a ValidateError exception on validation fails |
| message | None | Add a custom message to the ValidateError exception |
ValidateISBN¶
Check if the new value is valid ISBN (International Standard Book Number). Allows ISBN10 or ISBN13
Validation provided by: isbnlib More reference: https://en.wikipedia.org/wiki/International_Standard_Book_Number
Parametes:
| Parameter | Default | Description |
|---|---|---|
| field | SQLAlchemy column to validate | |
| allow_null | True | Allow null values |
| throw_exception | False | Throw a ValidateError exception on validation fails |
| message | None | Add a custom message to the ValidateError exception |