linting etc.
This commit is contained in:
@ -1,18 +1,13 @@
|
||||
import itertools
|
||||
from typing import Any, List, Tuple, Union
|
||||
|
||||
from databases.backends.postgres import Record
|
||||
import sqlalchemy
|
||||
from databases.backends.postgres import Record
|
||||
|
||||
import ormar.queryset # noqa I100
|
||||
from ormar.fields.many_to_many import ManyToManyField
|
||||
from ormar.models import NewBaseModel # noqa I100
|
||||
|
||||
import logging
|
||||
import sys
|
||||
|
||||
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
|
||||
|
||||
|
||||
def group_related_list(list_: List) -> dict:
|
||||
test_dict = dict()
|
||||
@ -94,14 +89,14 @@ class Model(NewBaseModel):
|
||||
return item
|
||||
|
||||
@classmethod
|
||||
def extract_prefixed_table_columns(
|
||||
def extract_prefixed_table_columns( # noqa CCR001
|
||||
cls, item: dict, row: sqlalchemy.engine.result.ResultProxy, table_prefix: str
|
||||
) -> dict:
|
||||
for column in cls.Meta.table.columns:
|
||||
logging.debug('column to extract:' + column.name)
|
||||
logging.debug(f'{row.keys()}')
|
||||
if column.name not in item:
|
||||
prefixed_name = f'{table_prefix + "_" if table_prefix else ""}{column.name}'
|
||||
prefixed_name = (
|
||||
f'{table_prefix + "_" if table_prefix else ""}{column.name}'
|
||||
)
|
||||
# databases does not keep aliases in Record for postgres
|
||||
source = row._row if isinstance(row, Record) else row
|
||||
item[column.name] = source[prefixed_name]
|
||||
|
||||
@ -9,10 +9,6 @@ from ormar.queryset import FilterQuery
|
||||
from ormar.queryset.clause import QueryClause
|
||||
from ormar.queryset.query import Query
|
||||
|
||||
import logging
|
||||
import sys
|
||||
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
|
||||
|
||||
if TYPE_CHECKING: # pragma no cover
|
||||
from ormar import Model
|
||||
|
||||
|
||||
Reference in New Issue
Block a user