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