Skip to content

Commit f892174

Browse files
Merged Alias Changes
2 parents 5b7f52c + ecbde0f commit f892174

File tree

3 files changed

+14
-6
lines changed

3 files changed

+14
-6
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ exclude: '^docs/conf.py'
22

33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v4.3.0
5+
rev: v4.4.0
66
hooks:
77
- id: trailing-whitespace
88
- id: check-added-large-files
@@ -28,7 +28,7 @@ repos:
2828
# --remove-unused-variables,
2929
# ]
3030
- repo: https://github.com/hadialqattan/pycln
31-
rev: v2.1.1
31+
rev: v2.1.3
3232
hooks:
3333
- id: pycln
3434
args: [--config=setup.cfg]
@@ -39,7 +39,7 @@ repos:
3939
- id: isort
4040

4141
- repo: https://github.com/psf/black
42-
rev: 22.8.0
42+
rev: 23.3.0
4343
hooks:
4444
- id: black
4545
language_version: python3
@@ -52,7 +52,7 @@ repos:
5252
# additional_dependencies: [black]
5353

5454
- repo: https://github.com/PyCQA/flake8
55-
rev: 5.0.4
55+
rev: 6.0.0
5656
hooks:
5757
- id: flake8
5858
## You can add flake8 plugins via `additional_dependencies`:

src/strawberry_sqlalchemy_mapper/loader.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,11 @@ async def load_fn(keys: List[Tuple]) -> List[Any]:
3939
def group_by_remote_key(row: Any) -> Tuple:
4040
return tuple(
4141
[
42-
getattr(row, remote.key)
42+
[
43+
getattr(row, k)
44+
for k, column in row.__mapper__.c.items()
45+
if remote.key == column.key
46+
][0]
4347
for _, remote in relationship.local_remote_pairs
4448
]
4549
)

src/strawberry_sqlalchemy_mapper/mapper.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,11 @@ async def resolve(self, info: Info):
413413
else:
414414
relationship_key = tuple(
415415
[
416-
getattr(self, local.key)
416+
[
417+
getattr(self, k)
418+
for k, column in self.__mapper__.c.items()
419+
if local.key == column.key
420+
][0]
417421
for local, _ in relationship.local_remote_pairs
418422
]
419423
)

0 commit comments

Comments
 (0)