tortoise / tortoise-orm

Familiar asyncio ORM for python, built with relations in mind
https://tortoise.github.io
Apache License 2.0
4.7k stars 391 forks source link

Parametrize SELECT queries #1777

Closed henadzit closed 1 week ago

henadzit commented 1 week ago

Description

This PR:

This PR is dependent on changes in pypika-tortoise https://github.com/tortoise/pypika-tortoise/pull/16. ⚠️ we should merge them first and release a new version of pypika-tortoise!

Motivation and Context

Parameterized queries are crucial for preventing SQL injection attacks and but also can improve performance of database operations.

How Has This Been Tested?

Checklist:

coveralls commented 1 week ago

Pull Request Test Coverage Report for Build 11958477626

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
tortoise/queryset.py 103 109 94.5%
<!-- Total: 146 152 96.05% -->
Files with Coverage Reduction New Missed Lines %
tortoise/backends/mysql/executor.py 3 88.89%
<!-- Total: 3 -->
Totals Coverage Status
Change from base Build 11922917874: 0.03%
Covered Lines: 6246
Relevant Lines: 6867

💛 - Coveralls
henadzit commented 1 week ago

@abondar, I replaced pypika's version, can you approve again? thanks!