Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into optimize-config-…
Browse files Browse the repository at this point in the history
…password-logging
  • Loading branch information
waketzheng committed Dec 27, 2024
2 parents 6cb4a8a + 968d0d5 commit 2158c45
Show file tree
Hide file tree
Showing 37 changed files with 301 additions and 290 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Changelog
------
Fixed
^^^^^
- Rename pypika to pypika_tortoise for fixing package name conflict (#1829)
- Concurrent connection pool initialization (#1825)

0.23.0
Expand Down Expand Up @@ -1505,4 +1506,4 @@ Docs/examples:
await Tournament.filter(
events__name__in=['1', '3']
).order_by('-events__participants__name').distinct()
).order_by('-events__participants__name').distinct()
444 changes: 224 additions & 220 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ classifiers = [

[tool.poetry.dependencies]
python = "^3.8"
pypika-tortoise = "^0.3.2"
pypika-tortoise = "^0.4.0"
iso8601 = "^2.1.0"
aiosqlite = ">=0.16.0, <0.21.0"
pytz = "*"
Expand Down
2 changes: 1 addition & 1 deletion tests/fields/test_db_index.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Any

from pypika.terms import Field
from pypika_tortoise.terms import Field

from tortoise import fields
from tortoise.contrib import test
Expand Down
2 changes: 1 addition & 1 deletion tests/test_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Any

import pytz
from pypika.terms import Function as PupikaFunction
from pypika_tortoise.terms import Function as PupikaFunction

from tests.testmodels import (
Currency,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_values.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pypika import CustomFunction
from pypika_tortoise import CustomFunction

from tests.testmodels import Event, Team, Tournament
from tortoise.contrib import test
Expand Down
2 changes: 1 addition & 1 deletion tortoise/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from types import ModuleType
from typing import Any, Callable, Coroutine, Iterable, Type, cast

from pypika import Query, Table
from pypika_tortoise import Query, Table

from tortoise.backends.base.client import BaseDBAsyncClient
from tortoise.backends.base.config_generator import expand_db_url, generate_config
Expand Down
2 changes: 1 addition & 1 deletion tortoise/backends/base/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
cast,
)

from pypika import Query
from pypika_tortoise import Query

from tortoise.backends.base.executor import BaseExecutor
from tortoise.backends.base.schema_generator import BaseSchemaGenerator
Expand Down
4 changes: 2 additions & 2 deletions tortoise/backends/base/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
cast,
)

from pypika import JoinType, Parameter, Table
from pypika.queries import QueryBuilder
from pypika_tortoise import JoinType, Parameter, Table
from pypika_tortoise.queries import QueryBuilder

from tortoise.exceptions import OperationalError
from tortoise.expressions import Expression, ResolveContext
Expand Down
2 changes: 1 addition & 1 deletion tortoise/backends/base_postgres/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
Union,
)

from pypika import PostgreSQLQuery
from pypika_tortoise import PostgreSQLQuery

from tortoise.backends.base.client import (
BaseDBAsyncClient,
Expand Down
4 changes: 2 additions & 2 deletions tortoise/backends/base_postgres/executor.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import uuid
from typing import Optional, Sequence, cast

from pypika.dialects import PostgreSQLQueryBuilder
from pypika.terms import Term
from pypika_tortoise.dialects import PostgreSQLQueryBuilder
from pypika_tortoise.terms import Term

from tortoise import Model
from tortoise.backends.base.executor import BaseExecutor
Expand Down
2 changes: 1 addition & 1 deletion tortoise/backends/mssql/client.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from itertools import count
from typing import Any, Optional, SupportsInt

from pypika.dialects import MSSQLQuery
from pypika_tortoise.dialects import MSSQLQuery

from tortoise.backends.base.client import (
Capabilities,
Expand Down
2 changes: 1 addition & 1 deletion tortoise/backends/mysql/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from pymysql.constants import COMMAND
from pymysql import err as errors

from pypika import MySQLQuery
from pypika_tortoise import MySQLQuery

from tortoise import timezone
from tortoise.backends.base.client import (
Expand Down
8 changes: 4 additions & 4 deletions tortoise/backends/mysql/executor.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pypika import functions
from pypika.enums import SqlTypes
from pypika.terms import BasicCriterion, Criterion
from pypika.utils import format_quotes
from pypika_tortoise import functions
from pypika_tortoise.enums import SqlTypes
from pypika_tortoise.terms import BasicCriterion, Criterion
from pypika_tortoise.utils import format_quotes

from tortoise import Model
from tortoise.backends.base.executor import BaseExecutor
Expand Down
2 changes: 1 addition & 1 deletion tortoise/backends/oracle/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from iso8601 import parse_date

parse_datetime = functools.partial(parse_date, default_timezone=None)
from pypika import OracleQuery
from pypika_tortoise import OracleQuery

from tortoise.backends.base.client import (
Capabilities,
Expand Down
4 changes: 2 additions & 2 deletions tortoise/backends/psycopg/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import psycopg.pq
import psycopg.rows
import psycopg_pool
from pypika.dialects.postgresql import PostgreSQLQuery, PostgreSQLQueryBuilder
from pypika.terms import Parameterizer
from pypika_tortoise.dialects.postgresql import PostgreSQLQuery, PostgreSQLQueryBuilder
from pypika_tortoise.terms import Parameterizer

import tortoise.backends.base.client as base_client
import tortoise.backends.base_postgres.client as postgres_client
Expand Down
2 changes: 1 addition & 1 deletion tortoise/backends/psycopg/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from typing import Optional

from pypika import Parameter
from pypika_tortoise import Parameter

from tortoise import Model
from tortoise.backends.base_postgres.executor import BasePostgresExecutor
Expand Down
2 changes: 1 addition & 1 deletion tortoise/backends/sqlite/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
)

import aiosqlite
from pypika import SQLLiteQuery
from pypika_tortoise import SQLLiteQuery

from tortoise.backends.base.client import (
BaseDBAsyncClient,
Expand Down
2 changes: 1 addition & 1 deletion tortoise/contrib/mysql/functions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from pypika.terms import Function
from pypika_tortoise.terms import Function


class Rand(Function):
Expand Down
2 changes: 1 addition & 1 deletion tortoise/contrib/mysql/indexes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from typing import Optional, Tuple

from pypika.terms import Term
from pypika_tortoise.terms import Term

from tortoise.indexes import Index

Expand Down
8 changes: 4 additions & 4 deletions tortoise/contrib/mysql/json_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import operator
from typing import Any, Dict, List

from pypika.functions import Cast
from pypika.terms import Criterion
from pypika.terms import Function as PypikaFunction
from pypika.terms import Term, ValueWrapper
from pypika_tortoise.functions import Cast
from pypika_tortoise.terms import Criterion
from pypika_tortoise.terms import Function as PypikaFunction
from pypika_tortoise.terms import Term, ValueWrapper

from tortoise.filters import get_json_filter_operator, not_equal

Expand Down
8 changes: 4 additions & 4 deletions tortoise/contrib/mysql/search.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from enum import Enum
from typing import Any, Optional

from pypika.enums import Comparator
from pypika.terms import BasicCriterion
from pypika.terms import Function as PypikaFunction
from pypika.terms import Term
from pypika_tortoise.enums import Comparator
from pypika_tortoise.terms import BasicCriterion
from pypika_tortoise.terms import Function as PypikaFunction
from pypika_tortoise.terms import Term


class Comp(Comparator):
Expand Down
2 changes: 1 addition & 1 deletion tortoise/contrib/postgres/functions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pypika.terms import Function, Term
from pypika_tortoise.terms import Function, Term


class ToTsVector(Function):
Expand Down
6 changes: 3 additions & 3 deletions tortoise/contrib/postgres/json_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from decimal import Decimal
from typing import Any, Callable, Tuple, cast

from pypika.enums import JSONOperators
from pypika.functions import Cast
from pypika.terms import BasicCriterion, Criterion, Term, ValueWrapper
from pypika_tortoise.enums import JSONOperators
from pypika_tortoise.functions import Cast
from pypika_tortoise.terms import BasicCriterion, Criterion, Term, ValueWrapper

from tortoise.filters import (
between_and,
Expand Down
2 changes: 1 addition & 1 deletion tortoise/contrib/postgres/regex.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import enum
from typing import cast

from pypika.terms import BasicCriterion, Term
from pypika_tortoise.terms import BasicCriterion, Term


class PostgresRegexMatching(enum.Enum):
Expand Down
4 changes: 2 additions & 2 deletions tortoise/contrib/postgres/search.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from typing import Union

from pypika.enums import Comparator
from pypika.terms import BasicCriterion, Function, Term
from pypika_tortoise.enums import Comparator
from pypika_tortoise.terms import BasicCriterion, Function, Term

from tortoise.contrib.postgres.functions import ToTsQuery, ToTsVector

Expand Down
2 changes: 1 addition & 1 deletion tortoise/contrib/sqlite/functions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pypika.terms import Function
from pypika_tortoise.terms import Function


class Random(Function):
Expand Down
18 changes: 9 additions & 9 deletions tortoise/expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
from enum import Enum
from typing import TYPE_CHECKING, Any, Iterator, Type, cast

from pypika import Case as PypikaCase
from pypika import Field as PypikaField
from pypika import Table
from pypika.functions import AggregateFunction, DistinctOptionFunction
from pypika.terms import ArithmeticExpression, Criterion
from pypika.terms import Function as PypikaFunction
from pypika.terms import Term, ValueWrapper
from pypika.utils import format_alias_sql
from pypika_tortoise import Case as PypikaCase
from pypika_tortoise import Field as PypikaField
from pypika_tortoise import Table
from pypika_tortoise.functions import AggregateFunction, DistinctOptionFunction
from pypika_tortoise.terms import ArithmeticExpression, Criterion
from pypika_tortoise.terms import Function as PypikaFunction
from pypika_tortoise.terms import Term, ValueWrapper
from pypika_tortoise.utils import format_alias_sql

from tortoise.exceptions import FieldError, OperationalError
from tortoise.fields.base import Field
Expand All @@ -27,7 +27,7 @@
)

if TYPE_CHECKING: # pragma: nocoverage
from pypika.queries import Selectable
from pypika_tortoise.queries import Selectable

from tortoise.models import Model
from tortoise.queryset import AwaitableQuery
Expand Down
2 changes: 1 addition & 1 deletion tortoise/fields/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
overload,
)

from pypika.terms import Term
from pypika_tortoise.terms import Term

from tortoise.exceptions import ConfigurationError, ValidationError
from tortoise.validators import Validator
Expand Down
6 changes: 3 additions & 3 deletions tortoise/fields/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
from typing import TYPE_CHECKING, Any, Callable, Optional, Type, TypeVar, Union
from uuid import UUID, uuid4

from pypika import functions
from pypika.enums import SqlTypes
from pypika.terms import Term
from pypika_tortoise import functions
from pypika_tortoise.enums import SqlTypes
from pypika_tortoise.terms import Term

from tortoise import timezone
from tortoise.exceptions import ConfigurationError, FieldError
Expand Down
2 changes: 1 addition & 1 deletion tortoise/fields/relational.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
overload,
)

from pypika import Table
from pypika_tortoise import Table
from typing_extensions import Literal

from tortoise.exceptions import ConfigurationError, NoValuesFetched, OperationalError
Expand Down
14 changes: 10 additions & 4 deletions tortoise/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,16 @@
TypedDict,
)

from pypika import Table
from pypika.enums import DatePart, Matching, SqlTypes
from pypika.functions import Cast, Extract, Upper
from pypika.terms import BasicCriterion, Criterion, Equality, Term, ValueWrapper
from pypika_tortoise import Table
from pypika_tortoise.enums import DatePart, Matching, SqlTypes
from pypika_tortoise.functions import Cast, Extract, Upper
from pypika_tortoise.terms import (
BasicCriterion,
Criterion,
Equality,
Term,
ValueWrapper,
)
from typing_extensions import NotRequired

from tortoise.fields import Field, JSONField
Expand Down
2 changes: 1 addition & 1 deletion tortoise/functions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pypika import functions
from pypika_tortoise import functions

from tortoise.expressions import Aggregate, Function

Expand Down
2 changes: 1 addition & 1 deletion tortoise/indexes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from typing import TYPE_CHECKING, Any, Type

from pypika.terms import Term, ValueWrapper
from pypika_tortoise.terms import Term, ValueWrapper

if TYPE_CHECKING:
from tortoise import Model
Expand Down
4 changes: 2 additions & 2 deletions tortoise/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
cast,
)

from pypika import Order, Query, Table
from pypika.terms import Term
from pypika_tortoise import Order, Query, Table
from pypika_tortoise.terms import Term
from typing_extensions import Self

from tortoise import connections
Expand Down
4 changes: 2 additions & 2 deletions tortoise/query_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
from copy import copy
from typing import TYPE_CHECKING, List, Optional, Tuple, Type, cast

from pypika import Table
from pypika.terms import Criterion, Term
from pypika_tortoise import Table
from pypika_tortoise.terms import Criterion, Term

from tortoise.exceptions import ConfigurationError, OperationalError
from tortoise.fields.base import Field
Expand Down
10 changes: 5 additions & 5 deletions tortoise/queryset.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@
overload,
)

from pypika import JoinType, Order, Table
from pypika.analytics import Count
from pypika.functions import Cast
from pypika.queries import QueryBuilder
from pypika.terms import Case, Field, Star, Term, ValueWrapper
from pypika_tortoise import JoinType, Order, Table
from pypika_tortoise.analytics import Count
from pypika_tortoise.functions import Cast
from pypika_tortoise.queries import QueryBuilder
from pypika_tortoise.terms import Case, Field, Star, Term, ValueWrapper
from typing_extensions import Literal, Protocol

from tortoise.backends.base.client import BaseDBAsyncClient, Capabilities
Expand Down

0 comments on commit 2158c45

Please sign in to comment.