Hm, lemme think, on top of my head you'd need:

Table('node_type', engine,
 Column('node_type_id', Integer, Sequence('node_type_seq'), primary_key=True),
 Column('name', String(255), nullable=False),
 )

Table('node', engine,
 Column('node_id', Integer, Sequence('node_seq'), primary_key=True),
 Column('node_type_id', Integer, ForeignKey('node_type.id'),
 )

Table('tag_node', engine,
 Column('tag_node_id', Integer, ForeignKey('node.id'), primary_key=True)),
 Column('name', String(255), nullable=False),
 )

Table('text_node', engine,
 Column('text_node_id', Integer, ForeignKey('node.id'), primary_key=True)),
 Column('data', String(), nullable=False),
 )

Table('attribute_node', engine,
 Column('attribute_node_id', Integer, ForeignKey('node.id'), primary_key=True),
 Column('name', String(255), nullable=False),
 Column('value', String(), nullable=False),
 )

Table('children', engine,
 Column('children_id', Integer, Sequence('children_seq'), primary_key=True),
 Column('tag_node_id', Integer, ForeignKey('tag_node.id'), nullable=False),
 Column('node_id', Integer, ForeignKey('node.id'), nullable=False),
 Column('ordering', Integer, nullable=False),
 )

And that's it. uhm, that'd really be 6 tables in all wouldn't it?

Quoting Michael Bayer <[EMAIL PROTECTED]>:

> yah if i were storing XML id go with this kind of thing too (although =20=
>
> i prefer straight adjacency list with a "root id" node to store =20
> groups of XML tags...since when are you going to load only part of =20
> the XML for a particular document ?)
>
> with regards to nested sets, what id really *love* to use is this, =20
> but i dont know how to do it without PL/SQL (it is amazing with oracle):
>
>       http://www.dbazine.com/oracle/or-articles/tropashko4
>
> On May 8, 2006, at 6:40 PM, Lu=EDs Bruno wrote:
>
> > Michael Bayer wrote:
> >> like if i hired you and said, "we have to store XML docs, heres =20
> >> our DTD" youd go and make a table for every DTD element ?
> >
> > Just a friendly note to tell you I'm a rabid fan of the nested set =20
> > model to store hierarchical data (this case, the document structure).
> >
> > In (the longshot) case you haven't seen it:
> > http://www.developersdex.com/gurus/articles/112.asp
> >
> > --=20
> > Lu=EDs Bruno
>
>
>
> -------------------------------------------------------
> Using Tomcat but need to do more? Need to support web services, security?
> Get stuff done quickly with pre-integrated technology to make your job easier
> Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
> _______________________________________________
> Sqlalchemy-users mailing list
> Sqlalchemy-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users
>
>




-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to