Skip to content

Commit

Permalink
build(deps): bump sqlalchemy from 2.0.18 to 2.0.19 (#752)
Browse files Browse the repository at this point in the history
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Sam Bull <aa6bs0@sambull.org>
  • Loading branch information
dependabot[bot] and Dreamsorcerer committed Jul 29, 2023
1 parent 74fa464 commit 1835531
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions aiohttp_admin/backends/sqlalchemy.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,12 @@ def __init__(self, db: AsyncEngine, model_or_table: Union[sa.Table, type[Declara
mapper = sa.inspect(model_or_table)
assert mapper is not None # noqa: S101
for name, relationship in mapper.relationships.items():
# https://github.com/sqlalchemy/sqlalchemy/discussions/10161#discussioncomment-6583442
assert relationship.local_remote_pairs # noqa: S101
if len(relationship.local_remote_pairs) > 1:
raise NotImplementedError("Composite foreign keys not supported yet.")
if not isinstance(relationship.entity.persist_selectable, sa.Table):
continue
local, remote = relationship.local_remote_pairs[0]

props = {"reference": relationship.entity.persist_selectable.name,
Expand All @@ -214,11 +218,11 @@ def __init__(self, db: AsyncEngine, model_or_table: Union[sa.Table, type[Declara
props["link"] = "show"

children = {}
for c in relationship.target.c.values():
if c is remote: # Skip the foreign key
for kc in relationship.target.c.values():
if kc is remote: # Skip the foreign key
continue
field, inp, c_props = get_components(c.type)
children[c.name] = {"type": field, "props": c_props}
field, inp, c_props = get_components(kc.type)
children[kc.name] = {"type": field, "props": c_props}
container = "Datagrid" if t == "ReferenceManyField" else "DatagridSingle"
props["children"] = {"_": {"type": container, "props": {
"children": children, "rowClick": "show"}}}
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ pydantic==1.10.9
pytest==7.4.0
pytest-aiohttp==1.0.4
pytest-cov==4.1.0
sqlalchemy==2.0.18
sqlalchemy==2.0.19
typing_extensions>=3.10; python_version<"3.10"

0 comments on commit 1835531

Please sign in to comment.