I had a similar problem while using SQLAlchemy's declarative_mapper API.
My suggestion is to double-check  your columns options so they support
NULL constraints, like when using "delete-orphan" with MySQL. And it's
probably not Elixir specific, but close.. ;-)

Hth,

Etienne

cleg wrote:
> Hello
> 
> I'm using such classes:
> 
> class Domain(Entity):
>     using_options(tablename='domains')
> 
>     name = Field(Unicode(1024), nullable = False, unique = True, index
> = True)
> 
>     options = OneToMany('DomainOptions')
> 
> class DomainOptions(Entity):
>     using_options(tablename="domain_options")
> 
>     domain = ManyToOne('Domain', colname='domain_id', required = True,
> use_alter=True,
>                                      ondelete = 'CASCADE', onupdate =
> 'CASCADE')
> 
>     option = Field(Unicode(256), nullable = False)
> 
> When I'm trying to delete any of domains, I'm receiving such error:
> IntegrityError: (IntegrityError) null value in column "domain_id"
> violates not-null constraint
>  'UPDATE domain_options SET domain_id=%(domain_id)s WHERE
> domain_options.id = %(domain_options_id)s' {'domain_options_id': 8,
> 'domain_id': None}
> 
> So, instead of "cascade" behavior, I'm receiving "set null".
> I've tried another syntax:
> cascade="all,delete-orphan"
> 
> With same result.
> 
> Please, help me to clarify what am I doing wrong. Thanks in advance.
> 
> Regards,
> cleg
> 
> > 
> 


-- 
Etienne Robillard <[email protected]>
Green Tea Hackers Club <http://gthc.org/>
Blog: <http://gthc.org/blog/>
PGP Fingerprint: AED6 B33B B41D 5F4F A92A  2B71 874C FB27 F3A9 BDCC

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SQLElixir" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to