gaetan

to answer your question, the error occurs at table creation time

here's the additional info you ask for: first the test program
(elixirtest.py) and then the error trace:

### begin elixirtest.py

from elixir import *

metadata.connect("mysql://[EMAIL PROTECTED]/myapp")

class User(Entity):
        has_field('id', String(255), primary_key=True)
        has_field('name', Unicode(255), default="")

class Group(User):
        has_and_belongs_to_many('users', of_kind="Individual",
inverse="groups")

class Individual(User):
        has_and_belongs_to_many('groups', of_kind="Group", inverse="users")

### end elixirtest.py

### begin error trace

Python 2.4.2 (#1, Mar 22 2006, 18:15:19)
[GCC 4.0.1 (Apple Computer, Inc. build 5250)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import elixirtest
>>> elixirtest.create_all()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/sw/lib/python2.4/site-packages/Elixir-0.3.0-py2.4.egg/elixir/
__init__.py", line 71, in create_all
  File "build/bdist.darwin-8.8.2-i386/egg/sqlalchemy/schema.py", line
1150, in create_all
  File "build/bdist.darwin-8.8.2-i386/egg/sqlalchemy/engine/base.py",
line 645, in create
  File "build/bdist.darwin-8.8.2-i386/egg/sqlalchemy/engine/base.py",
line 675, in _run_visitor
  File "build/bdist.darwin-8.8.2-i386/egg/sqlalchemy/schema.py", line
1172, in accept_visitor
  File "build/bdist.darwin-8.8.2-i386/egg/sqlalchemy/ansisql.py", line
755, in visit_metadata
  File "build/bdist.darwin-8.8.2-i386/egg/sqlalchemy/schema.py", line
1128, in table_iterator
  File "build/bdist.darwin-8.8.2-i386/egg/sqlalchemy/sql_util.py",
line 33, in sort
  File "build/bdist.darwin-8.8.2-i386/egg/sqlalchemy/sql_util.py",
line 54, in _do_sort
  File "build/bdist.darwin-8.8.2-i386/egg/sqlalchemy/sql.py", line
510, in traverse
  File "build/bdist.darwin-8.8.2-i386/egg/sqlalchemy/sql.py", line
510, in traverse
  File "build/bdist.darwin-8.8.2-i386/egg/sqlalchemy/sql.py", line
511, in traverse
  File "build/bdist.darwin-8.8.2-i386/egg/sqlalchemy/schema.py", line
731, in accept_visitor
  File "build/bdist.darwin-8.8.2-i386/egg/sqlalchemy/sql_util.py",
line 48, in visit_foreign_key
  File "build/bdist.darwin-8.8.2-i386/egg/sqlalchemy/schema.py", line
726, in <lambda>
  File "build/bdist.darwin-8.8.2-i386/egg/sqlalchemy/schema.py", line
710, in _init_column
  File "build/bdist.darwin-8.8.2-i386/egg/sqlalchemy/schema.py", line
156, in __call__
sqlalchemy.exceptions.ArgumentError: Table 'None.elixirtest_group' not
defined

### end error trace

On May 1, 4:50 am, "Gaetan de Menten" <[EMAIL PROTECTED]> wrote:
> > On 1 touko, 05:33, "Gregory W. Bond" <[EMAIL PROTECTED]> wrote:
>
> > > what i want to do is quite simple really: i want a parent superclass
> > > "User" with two child subclasses "Group" and "Individual" i.e. a
> > > "User" can be a "Group" or an "Individual" - furthermore i want a
> > > "Group" to consist of a set of "Individuals"
>
> > > here's how i specified this with Elixir:
>
> > > class User(Entity):
> > >         has_field('id', String(255), primary_key=True)
> > >         has_field('name', Unicode(255), default="")
> > >         using_options(tablename='users')
>
> > > class Group(User):
> > >         has_and_belongs_to_many('users', of_kind="Individual",
> > > inverse="groups")
>
> > > class Individual(User):
> > >          has_and_belongs_to_many('groups', of_kind="Group", 
> > > inverse="users")
>
> Could you provide more details? When do you have an error (at the
> table creation time), at "module-load" (ie class creation) time, when
> you try to populate your tables with data (probably flush time), or
> ...? And if you could provide me with a complete example (using Elixir
> only) which shows the errors, that'd save me time for the debugging.
>
> It might be impossible to do for now because I don't see any problem
> with your code at first glance. I know that such relationships to
> inherited classes are tricky.  I'll look into that some more whenever
> I got some time to (unfortunately that might be in a while).
> --
> Gaƫtan de Mentenhttp://openhex.org


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