On 11/30/2015 02:29 PM, Alyssa Kwan wrote:
> Thanks Michael,
> 
> These constructs are actually composed of 3 tables - the temporal data
> itself, a clock table, and an element clock table - both the clocks keep
> track of points in time that exist within time ranges since ranges are
> lossy. Does this advice still hold? 

yes, don't subclass SchemaItem :)   Unless you're building out a
Postgresql extension and your own "CREATE" command that you could run
with psql (assuming that's not the case).



A related requirement is the ability
> to autoload via reflection these constructs, for which I've created
> tables similar to INFORMATION_SCHEMA.TABLES and
> INFORMATION_SCHEMA.COLUMNS. I'm only concerned about operating on
> PostgreSQL.



> 
> What's the recommended way to approaching this?
> 
> Thanks,
> Alyssa
> 
> On Monday, November 30, 2015 at 10:26:28 AM UTC-8, Michael Bayer wrote:
> 
> 
> 
>     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
>     
> <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+...@googlegroups.com <javascript:>
>     > <mailto:sqlalchemy+unsubscr...@googlegroups.com <javascript:>>.
>     > To post to this group, send email to sqlal...@googlegroups.com
>     <javascript:>
>     > <mailto:sqlal...@googlegroups.com <javascript:>>.
>     > Visit this group at http://groups.google.com/group/sqlalchemy
>     <http://groups.google.com/group/sqlalchemy>.
>     > For more options, visit https://groups.google.com/d/optout
>     <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
> <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