Skip to main content

No project description provided

Project description

Testing

CouchDB

http://localhost:5984/_utils/#

  • user: admin
  • passwd: pytest

Initialization

Automatic initialization from environment

init_backend()

Manual initialization

Example for MongoDB with alias.

If missing, the default for alias is "default"

MongoDbBackend(alias="people")

client = Backend.client(alias="people")

Pagination

Usage with routers

@router.get("/people")
@pagination()
def people_get():
    return Backend.client().get_instances(PeopleModel)

Custom usage in code

pagination_params = PaginationParameterModel
with pagination_provider(pagination_params) as p:
    Backend.client().get_instances(PeopleModel)
pagination_params = PaginationParameterModel
with pagination_provider(pagination_params) as p:
    Backend.client().get_instances(PeopleModel)


pagination_params = PaginationParameterModel
with pagination_parameter_provider(pagination_params):
    objs, max_results = Backend.client().pagination_aggregate(agg)
    


return pagination_result((objs, max_results))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pydantic_db_backend-3.3.0.tar.gz (8.5 kB view hashes)

Uploaded Source

Built Distribution

pydantic_db_backend-3.3.0-py3-none-any.whl (11.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page