Hi all,

I am using elixir for a project over 2years now. I have to move to 0.6
(old, I know, but it's now in lenny). Some (all db :-/) of the code
breaks down. I followed the Migration tutorial (commit, flush ...) but
I am still getting the same error.

from elixir import *

metadata.bind = 'sqlite://'
metadata.bind.echo = True

class Movie(Entity):
    title = Field(Unicode(30), primary_key=True)
    year = Field(Integer)
    description = Field(UnicodeText)
    characters = OneToMany('Character', inverse='movie')

class Character(Entity):
    movie = ManyToOne('Movie', primary_key=True)
    name = Field(Unicode(60), primary_key=True)

setup_all()
create_all()

matrix = Movie(title='Matrix')
Character.query.all()   # or Movie.query.all() # (*)
rabbit = Character(name='The White Rabbit')
matrix.characters.append(rabbit) # long exception ....
session.commit()

result:
Traceback (most recent call last):
  File "t.py", line 23, in <module>
    matrix.characters.append(rabbit)
  File "/usr/lib/pymodules/python2.5/sqlalchemy/orm/attributes.py",
line 158, in __get__
    return self.impl.get(instance_state(instance),
instance_dict(instance))
# snip
  File "/usr/lib/pymodules/python2.5/sqlalchemy/engine/base.py", line
931, in _handle_dbapi_exception
    raise exc.DBAPIError.instance(statement, parameters, e,
connection_invalidated=is_disconnect)
sqlalchemy.exc.IntegrityError: (IntegrityError)
__main___character.movie_title may not be NULL u'INSERT INTO
__main___character (name) VALUES (?)' ['The White Rabbit']


If i remove line (*), everything works. But I don't have such a simple
case (at least two queries). The same error happens over the trunk
code. Also tried to exchange sessionmaker for create_session, no luck
either.
How is it possible that it worked some time ago? :(

Thanks for help...
Karol

-- 
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