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

Add support for case insensitive regexp + add support for REGEXP SQLite module #1737

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

larsschwegmann
Copy link
Contributor

This PR adds support for case insentive regex filtering (postgres and sqlite). It also adds support for the REGEXP sqlite module (needs to be installed in sqlite to work).

Description

Postgres and SQLite offer ways to query with regular expression while ignoring case, similiarly how we already have case insensitive contains, etc. This PR adds support for these filters.

This PR also adds support for SQLite (regexp() function needs to be supplied at runtime, e.g. via an extension). It is installed by default on most linux distributions of sqlite.

Motivation and Context

I want to query case insensitive regex patterns. Having sqlite support is good for completeness. Many people including me use sqlite for unit tests, so having feature parity across db backends is aa big plus.

How Has This Been Tested?

Ran the tests suite

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added the changelog accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 11324387264

Details

  • 14 of 19 (73.68%) changed or added relevant lines in 5 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.02%) to 88.989%

Changes Missing Coverage Covered Lines Changed/Added Lines %
tortoise/filters.py 1 2 50.0%
tortoise/contrib/postgres/regex.py 3 5 60.0%
tortoise/contrib/sqlite/regex.py 6 8 75.0%
Totals Coverage Status
Change from base Build 11323175489: -0.02%
Covered Lines: 5993
Relevant Lines: 6620

💛 - Coveralls

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

Successfully merging this pull request may close these issues.

2 participants