* Add CockroachDsn type
The CockroachDsn type supports the following dialects: cockroachdb,
cockroachdb+psycopg2 and cockroachdb+asyncpg. It's meant to be used in
conjunction with the cockroachdb sqlalchemy dialect, more information
can be found here:
https://github.com/cockroachdb/sqlalchemy-cockroachdb
* tweak change log
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
* updates to description of the fields option.
Update of the fields option for config to reflect the fact that it is not actually equivalent to the Field class, as I was having troubles understanting ehy I couldn't set default or default_factory.
* corrected typo
* correction
* fix typo
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
* add support for alias handling in validate_arguments
* add test for alias handling in validate_arguments
* add documentation on alias support for decorator
* bug fixed in the validate_argumen decorator documentation
* add changes README
* change in the documentation due to a drafting error
* Update changes/3019-MAD-py.md
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* more challenging tests
* run the format checker
* integration of empty string as alias
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
* Create utils.py
I needed non pascal case camel case support
* write tests for new `to_lower_camel()` function
* Create 3463-schlerp.md
* added mention to to_lower_camel()
* changed quotes to single tick
* adding second blank line at end of file.
* again, adding second blank line...
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
* Move host regex out of url_regex and inject it afterwards
* Add new host regex with cache variable
* Move url regex strings to separate variables
* Add new postgres url regex with cache variable
* Add tests for failed postgres dns with many hosts
* Add new parts type: HostParts
* Add new slot 'hosts' to PostgreDsn and update init with it
* Add validators to PostgreDsn class.
When multiple hosts are found, all hosts will be store in hosts list. To
keep back compatibility single host will return all data as previously
in main params.
* Add more detail tests to check multi host postgres dsn with attributes
* Add changes description in the file
* Delete usless comments to regex strings because of varable names
* Add missing docstring to postgres_url_regex function
* Update postgre dsn with AnyUrl.slots
* Update AnyUrl.validate_parts to support disabling port validation
* Reuse _host_regex in postgres_url_regex
* Fix typing
* Delete not needed group in regex
* Improve tests by adding parametrize to postgreDsn tests
* Update postgres regex to not validate hosts in it
* Delete duplicated code and use shared validate method
* Move multi host methods into separate class and inherit it in the postgreDsn
* fix tests
* tweaks and re order code
* add a note to docs
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
* Add MongoDsn to pydantic.networks with allowed_schemas and get_default_parts
* Add unit test to MongoDsn and remove default host from default parts becouse it's required by MongoDB protocol
* Fix import issues, follow contributing guide
* Add changes to docs
* Add changes to changelog
* Added support for Rich Repr protocol
* restore line
* Words
* quotes
* Update changes/3099-willmcgugan.md
Adds code to markdown
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* added usage with Rich
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
* fix: handle basemodel fallback for custom encoders
* put back old behaviour and add to_dict
* typo
Co-authored-by: Christian Bundy <christianbundy@fraction.io>
Co-authored-by: Christian Bundy <christianbundy@fraction.io>
* Add RabbitmqDsn
Will update once finished - haven't looked at the CONTRIB yet. Want to test locally to see if it works.
* added tests; added to docs
* added changes
* fixed import in networks.py
* fixed linting issues; fixed __init__.py import issue
* sorted imports
* added trailing comma on imports
* Merge master
* Change class name from RabbitmqDsn to RabbitMqDsn
* Format code
* Rename change file and prettify content
* Fix RabbitMQ name on documentation
* Add a trivial test
* Address Samuel and Nuno's comments
* Refactor AMQP tests according to Redis tests style
* Update docs/examples/settings_main.py
* cleanup
Co-authored-by: Thomas <thomas@9bitbyte.com>
Co-authored-by: Thomas Crha <tom.crha@dragonflytechnologies.com>
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
* ✨ Add support for Decimal-specific configs in Field()
* ✅ Add/update tests for condecimal and variant with Field()
* 📝 Update schema - Field() docs including Decimal-specific configs
* 📝 Add PR changes file
* Add unique items validation to constrained list
* add unique_items to field and schema
add failover for unhashable types
check keyword value to call the validator
add some tests
* update unique_items validation
Co-authored-by: Nuno André Novo <nuno.novo@forensic-security.com>
Co-authored-by: Samuel Colvin <s@muelcolvin.com>
* Try to evaluate forward refs after model created
* Upadate docs and remove code duplication
* Update changes/2588-uriyyo.md
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* Update docs/usage/postponed_annotations.md
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* Remove unused import
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* add `FileUrl` type for `file://` schemes
Also add a `host_required` parameter, True by default,
False in `FileUrl` and `RedisDsn`.
* chore: useless extra in assert statement
Co-authored-by: PrettyWood <em.jolibois@gmail.com>
* Added suport to postgresql async driver
* Added postgres+asyncpg in the doc.
* Added changes file
* Added postgresql+pg8000 schema
* ran make format
* Update docs/usage/types.md
Co-authored-by: Stephen Brown II <Stephen.Brown2@gmail.com>
* Changed from schema to scheme
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* fixed typo scheme
* fixed merge schema
* changed to one line description
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* added others DBAPI dialects.
* Added two # by PrettyWood
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* fix typo by PrettyWood
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* Fixed typo by PrettyWood
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* added postgresql+psycopg2 in changes dir
* Fixed typo by @samuelcolvin
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
* docs: fix typo
* chore: sort alphabetically
Co-authored-by: Fernando Ike <fernando.ike@maburix.com>
Co-authored-by: Stephen Brown II <Stephen.Brown2@gmail.com>
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
* Add GetterDict example
* Update docs/usage/models.md
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>
* add repr parameter to hide a field from repr()
* fix styling issues
… found by flake8.
* fix type annotation issues
* correctly name changes file
* test hiding default values from repr() of a Field
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
Co-authored-by: Eric Jolibois <em.jolibois@gmail.com>
* Fix(docs): remove colon to separate unrelated clauses
The colon at the end of the line "The fields which were supplied when user was initialised:" suggests that the code following it is related.
Changed it to a period.
* Include change summary readme.
* Add exclude/include as field parameters
- Add "exclude" / "include" as a field parameter so that it can be
configured using model config (or fields) instead of purely at
`.dict` / `.json` export time.
- Unify merging logic of advanced include/exclude fields
- Add tests for merging logic and field/config exclude/include params
- Closes#660
* Precompute include/exclude fields for class
* Increase test coverage
* Remove (now) redundant type checks in Model._iter: New
exclusion/inclusion algorithms guarantee that no sets are passed further down.
* Add docs for advanced field level exclude/include settings
* Minimal optimization for simple exclude/include export
Running benchmarks this vs. master is at:
this: pydantic best=33.225μs/iter avg=33.940μs/iter stdev=1.120μs/iter version=1.7.3
master: pydantic best=32.901μs/iter avg=33.276μs/iter stdev=0.242μs/iter version=1.7.3
* Apply review comments on exclude/enclude field arguments
* Fix/simplify type annotations
* Allow both ``True`` and ``Ellipsis`` to be used to indicate full field
exclusion
* Reenable hypothesis plugin (removed by mistake)
* Update advanced include/include docs to use ``True`` instead of ``...``
* Move field info exclude/include updates into FieldInfo class
This way, the model field object does not need to concern itself with
dealing with field into specific fields.
(Same was done for alias in a previous commit).
* remove double back tick in markdown.
Co-authored-by: Samuel Colvin <samcolvin@gmail.com>