Hi!

I added a new self-referential relationship to one of my tables but since I 
couldn't find how to create the new column through SA I added it to the db 
manually after checking how it's been done before. 

The code looks like this (using elixir):
class User(Entity):
    username = Field(String(80),  primary_key=True)

    # New fields
    parent = ManyToOne('User')
    children = OneToMany('User')

So I added a field in the db with the name "parent_name" since I noticed 
thats how SA names foreign keys and I also indexed it with the name 
ix_user_parent_name

Do I need to do anything else to get this to work or have I done anything 
wrong? 

What I get is: " 'str' object has no attribute '_state' " for that object 
in _get_committed_attr_by_column. 

I read that this means that I add a string to a relationship object, but I 
could access the parents fields when testing. 





-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sqlalchemy/-/RJ-iAdcQWDoJ.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to