[sqlalchemy] Re: Get sqlalchemy base class object instead of children

2018-12-10 Thread Tolstov Sergey
This query return orm objects. If it will return view as you want, in your session may have two copies of one object ** and * *and they not equals, but need to be equals If you need to print values - You need to create something simular to decorator of data, that return copy of required

[sqlalchemy] composite type nested

2018-12-10 Thread Tolstov Sergey
Can someone have example of this? Example is class TownDetail(object): def __init__(self, name, value): self.name = name self.value = value def __composite_values__(self): return self.name, self.value def __eq__(self, other): return isinstance(other, self.__class__) and\

Re: [sqlalchemy] ORM insert: How to insert into a table with Identity column in Redshift database.

2018-12-10 Thread Mike Bayer
On Mon, Dec 10, 2018 at 1:23 AM Ved Bhatnagar wrote: > > Hi, > > How can I use ORM insert (session.add(object)) to insert values in a table > with identity column in redshift database? their docs seem to be kind of incomplete on this but reading the source it looks like redshift-specific

Re: [sqlalchemy] Get sqlalchemy base class object instead of children

2018-12-10 Thread Mike Bayer
On Mon, Dec 10, 2018 at 6:17 AM Mehrdad Pedramfar < mehrdad1373pedram...@gmail.com> wrote: > Hi everybody, > I have three classes in my model, which one class inherited by the other > two: > > > class Item(Base): > __tablename__ = 'item' > > id = Column(Integer,

[sqlalchemy] Get sqlalchemy base class object instead of children

2018-12-10 Thread Mehrdad Pedramfar
Hi everybody,I have three classes in my model, which one class inherited by the other two:     class Item(Base):        __tablename__ = 'item'         id = Column(Integer, primary_key=True)        title = Column(Unicode(300))        type = Column(Unicode(50))         __mapper_args__ = {         

Re: [sqlalchemy] Re: ORM: read from view but write into separate table

2018-12-10 Thread Stanislav Lobanov
Great explanation, thank you very much. I think that in case one uses versioned approach with changing ids then is it better to have some automated function that will make "expire-changestate-readd" dance by introspecting relations on the object, because if a programmer forget to override