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

2018-12-06 Thread Stanislav Lobanov
Thank you so much, Mike! Did not tried it yet, but it looks like you nailed it :) I'll check the sources on holidays. With the deepest respect, Stanislav. четверг, 6 декабря 2018 г., 22:41:20 UTC+3 пользователь Mike Bayer написал: > > given that it looks like a new version for you means an

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

2018-12-06 Thread Mike Bayer
given that it looks like a new version for you means an UPDATE of the old row and an INSERT of the new, here is that, which is again basically what we see at https://docs.sqlalchemy.org/en/latest/_modules/examples/versioned_rows/versioned_rows.html with some extra steps to emit the UPDATE for the

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

2018-12-06 Thread Mike Bayer
On Thu, Dec 6, 2018 at 3:53 AM Stanislav Lobanov wrote: > > Example business case is: > > Parent and child are added to the system (current date is 2018-01-01) > > Parent > id | start | end | data| child_id > 1 | 2018-01-01| 2018-01-11 | c1 | 1 # just

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

2018-12-06 Thread Stanislav Lobanov
> > given that now() is the current time, how do you determine "end' when > writing these rows? "end" must always be a date that's in the > future?What happens when now() passes "end", you get None for your > object? > When new object is created the "end" date is automatically (or

Re: [sqlalchemy] Making Metadata bases more independent

2018-12-06 Thread Mike Bayer
On Thu, Dec 6, 2018 at 6:58 AM Chris Wilson wrote: > > Dear Mike, > > Thanks for the very quick implementation! I didn't realise that people would > make relationships between different Bases, as I assumed that people would > use these to represent different databases (as we do), between which

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

2018-12-06 Thread Mike Bayer
On Thu, Dec 6, 2018 at 3:53 AM Stanislav Lobanov wrote: > > Example business case is: > > Parent and child are added to the system (current date is 2018-01-01) > > Parent > id | start | end | data| child_id > 1 | 2018-01-01| 2018-01-11 | c1 | 1 # just

Re: [sqlalchemy] Making Metadata bases more independent

2018-12-06 Thread Chris Wilson
Dear Mike, Thanks for the very quick implementation! I didn't realise that people would make relationships between different Bases, as I assumed that people would use these to represent different databases (as we do), between which there can be no (enforced) relationships. Then it wouldn't

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

2018-12-06 Thread Stanislav Lobanov
Example business case is: Parent and child are added to the system (current date is 2018-01-01) Parent id | start | end | data| child_id 1 | 2018-01-01| 2018-01-11 | c1 | 1 # just pointer to child with some id (now points to first child record)