On 11/30/2015 12:54 PM, Alyssa Kwan wrote:
> Hi,
> 
> The problem I'm trying to solve is I've created a multi-temporal
> relational table construct (à la bitemporality) that I want to create
> SQLAlchemy Core composite operations for (and eventually SQLAlchemy ORM).
> 
> Let's call these TemporalRelationSet's. I've subclassed SchemaItem. 

I'd not do that.    If the thing you're dealing with is a Table, use
Table.  If you want to define a bunch of special operations involving a
certain Table and you're not able to use ORM, make a TemporalRelationSet
of course, however, this is not a schema item.  It would refer to the
Table you're dealing with.  That is, prefer composition over
inheritance.   A SchemaItem is only intended to be the base of objects
that exist concretely within DDL.



I
> also do registration against a Registry class that I've subclassed
> MetaData for, with a __visit_name__ of 'registry'. The idea is that I
> initialize a Registry, can register Table's against it, as well as these
> TemporalRelationSet's.

When your TemporalRelationSet is created, it can put memos inside of
Table.info for its Table object; if you want things to happen when that
Table gets created, you can use the before_create / after_create event
listeners to handle this.


> 
> Does this make sense for what I'm trying to do?
> 
> If so, the specific problem I'm running into is create_all() on Registry
> doesn't do anything. I started digging into the Visitable metaclass, but
> hit a wall of understanding.

Stick to the event API here, see the overview at
http://docs.sqlalchemy.org/en/latest/core/events.html?highlight=after_create#schema-events.




> 
> I'm running Python 3.4.3 on OS X El Capitan with SQLAlchemy 1.0.9.
> 
> Thanks!
> Alyssa
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to sqlalchemy+unsubscr...@googlegroups.com
> <mailto:sqlalchemy+unsubscr...@googlegroups.com>.
> To post to this group, send email to sqlalchemy@googlegroups.com
> <mailto:sqlalchemy@googlegroups.com>.
> Visit this group at http://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to