Thanks a lot for the response, definitely helpful to know that I wasn't 
crazy not able to find some readily available support.

We don't have triggers for performance reasons in some other applications, 
but would like to still have quick crud running in python+sqlalchemy.  Are 
there any events that might be kicked off as it's creating 
insert/update/delete objects for an instance state?  I was checking out 
visit_delete for instance, but couldn't figure out how to access the 
underlying orm object or even the parameters in that case (is there any way 
to get the parameters?).  Is the orm interactions with table mostly 
disjoint, and we are only passing the necessary parameters to the core apis?

Thanks again!


On Wednesday, August 12, 2015 at 2:33:02 PM UTC-4, Michael Bayer wrote:
>
>
>
> On 8/12/15 1:04 PM, MR M wrote: 
> > Hi, 
> > 
> > Somewhat new to sqlalchemy, and I've read thru a lot of documentation 
> > about horizontal sharding and polymorphism features, but I'm still 
> > unsure of how to support postgresql partitioned tables with ORM. 
> > 
> > on the database side, I have (just a dummy example): 
> > 
> > -- start 
> > create table account ( 
> > user_id serial not null, 
> > name varchar(100), 
> > primary key(user_id)) 
> > ; 
> > create table acount_a ( 
> > check(substring(name, 1, 1) = 'A') 
> > ) inherits (account) 
> > ; 
> > create table acount_b ( 
> > check(substring(name, 1, 1) = 'B') 
> > ) inherits (account) 
> > ; 
> > --- end 
> > 
> > 
> > on the ORM side i just have: 
> > 
> > class Account(Base): 
> >     __tablename__ = 'account' 
> >     id = Column('user_id', ....) 
> >     name = Column(Varchar(100)...) 
> > 
> > 
> > I'd like to insert a new Account(name='Bob'), and have the record be 
> > inserted to account_b in code instead of relying on database triggers 
> > or rules. 
>
> If you're already relying on PG's special features, you would be best 
> off using the triggers as their documentation states.    While there 
> might be ways to implement half of PG's documented system on the Python 
> side using various events and other features, it would be complicated 
> and buggy.   PG's triggers and stored procedures can certainly handle 
> the entire job of keeping this sharding transparent so I don't see why 
> these have to be reinvented in Python. 
>
>
>
>
>

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