Skip to content

AttributeError when sqlalchemy model has field created by column_property #125

Description

@phaethon

I have a model, which includes column_property

class User(Base):
  name = Column(Text)
  lastname = Column(Text)
  full_name = column_property(name + " " + lastname)

When I start application I get this stack trace:

...
  File "/home/myhome/strawberry-test/lib/python3.10/site-packages/strawberry_sqlalchemy_mapper/mapper.py", line 371, in _convert_column_to_strawberry_type
    if column.nullable:
  File "/home/myhome/strawberry-test/lib/python3.10/site-packages/sqlalchemy/sql/elements.py", line 1495, in __getattr__
    raise AttributeError(
AttributeError: Neither 'Label' object nor 'Comparator' object has an attribute 'nullable'

If I comment out the full_name field in the model, it works as expected.

Ubuntu 22.04, python 3.10, SQLAlchemy 2.027, psycopg 3.1.18, strawberry-sqlalchemy-mapper 0.4.2, strawberry-graphql 0.219.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions