Skip to main content

Extensions for sqlalchemy with databases

Project description

databases-query-extensions

Pagination, filter, search and sorting extensions for sqlalchey with encode/databases

Installation

pip install databases-query-extensions

Example

Construct page params

page_params = PaginationParams.construct(
      first=3, filter={"completed.is_true": ""}
  )

apply pagination and get results

  query = example.select()
  pagination = CursorPagination(database, query)
  paginated = await pagination.page(page_params)

apply filters, search, sorting or pagination and get query

    query = example.select()
    cursor_column="created_date"
    query = query_builder(query, page_params, cursor_column)

A complete query params example

{
    "first": 100,
    "after": <cursor>,
    "afterWith": <cursor>,
    "search": {
      "columns": ["col1", "col2"],
      "value": "new"
    },
    "filter": {
      "conversationType.eq": "Call"
      "conversationStatus.eq": "NoAanswer"
    },
    "sort": "createdAt",
    "order": "asc"
  }

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

databases-extensions-0.0.1.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

databases_extensions-0.0.1-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file databases-extensions-0.0.1.tar.gz.

File metadata

  • Download URL: databases-extensions-0.0.1.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.2

File hashes

Hashes for databases-extensions-0.0.1.tar.gz
Algorithm Hash digest
SHA256 c2a68b3ee940af83fee943a96e7b491b7537c608a2b66ccd47c4f032243e97d7
MD5 569895dc05d7fa7d63020c1f8109f3f6
BLAKE2b-256 e69cfa5850ef99e1e249b74716cfd27ac570252f59d89ba9e0c0774dc4855801

See more details on using hashes here.

File details

Details for the file databases_extensions-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: databases_extensions-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.2

File hashes

Hashes for databases_extensions-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9740ad4f7de087ab63cd2ec98a2f439cccdf6e04c855ee652e978586b7a143df
MD5 479ff802a3d349d3451a0d048e0027e2
BLAKE2b-256 5cfb87aaf3583d58e7a7086d9c3402c3b6ecaf4004abb523abc67222a5b9ff6b

See more details on using hashes here.

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