[sqlalchemy] delete not working on fk relation: sqlalchemy.exc.IntegrityError: (pymysql.err.IntegrityError) (1451, 'Cannot delete or update a parent row: a foreign key constraint fails

2019-05-14 Thread Jan Sakalos
Hello, i am unable to delete ReportModel entry, because of: sqlalchemy.exc.IntegrityError: (pymysql.err.IntegrityError) (1451, 'Cannot delete or update a parent row: a foreign key constraint fails (`qualys_guard`.`report_server2patch`, CONSTRAINT `report_server2patch_ibfk_3` FOREIGN KEY (`rep

Re: [sqlalchemy] Re: Query last relation created and attributes

2019-05-14 Thread Scheck David
In fact this I will use as a method on a datamanager use for different objects. In this sql the object is erfgoedobjecten but it will change. Le mar. 14 mai 2019 à 18:06, Jonathan Vanasco a écrit : > > > On Tuesday, May 14, 2019 at 10:29:58 AM UTC-4, Scheck David wrote: >> >> I'm near the result

Re: [sqlalchemy] Structured Inheritance model for ORM

2019-05-14 Thread Mike Bayer
Hi there - I normally wouldn't do things this way, however in seeking to provide an alternative architecture, the specific example you've given does work when used with the correct constructs, so I can provide both architectures. So you would need to illustrate specific scenarios that aren't wor

Re: [sqlalchemy] Re: Query last relation created and attributes

2019-05-14 Thread Jonathan Vanasco
On Tuesday, May 14, 2019 at 10:29:58 AM UTC-4, Scheck David wrote: > > I'm near the result of sql: > > https://dpaste.de/1XYa# > >> >>> Do you want this to be an attribute/relationship on the class or to run this as a separate query? -- SQLAlchemy - The Python SQL Toolkit and Object Relation

[sqlalchemy] Structured Inheritance model for ORM

2019-05-14 Thread Marcel Zoll
Hi, I am struggling since some days to extend and implement common class inheritance for the SQLAlchemy ORM objects that I define: Here is the to be achieved task: 1. In a first step, I want to use sqlalchemy to model my database and the ORM, aka define tables, define the ORMs and their relation

Re: [sqlalchemy] Re: Query last relation created and attributes

2019-05-14 Thread Scheck David
I'm near the result of sql: https://dpaste.de/1XYa# Le lundi 13 mai 2019 17:46:29 UTC+2, Mike Bayer a écrit : > > > > On Mon, May 13, 2019 at 10:37 AM Scheck David > wrote: > >> the problem is that I can't use SQL for this because this is a mixins >> that I use for several objects (tables) beca

Re: [sqlalchemy] Re: Query last relation created and attributes

2019-05-14 Thread Scheck David
Here is the last version of my sql query: https://dpaste.de/8UhP -- SQLAlchemy - The Python SQL Toolkit and Object Relational Mapper http://www.sqlalchemy.org/ To post example code, please provide an MCVE: Minimal, Complete, and Verifiable Example. See http://stackoverflow.com/help/mcve fo

Re: [sqlalchemy] Re: Query last relation created and attributes

2019-05-14 Thread Scheck David
> > > Here is the sql generated for this query : https://dpaste.de/bJsc Le lundi 13 mai 2019 17:46:29 UTC+2, Mike Bayer a écrit : > > > > On Mon, May 13, 2019 at 10:37 AM Scheck David > wrote: > >> the problem is that I can't use SQL for this because this is a mixins >> that I use for several

Re: [sqlalchemy] Re: Query last relation created and attributes

2019-05-14 Thread Scheck David
> > Here is my sql for this case > SELECT DISTINCT erfgoed.id as id, statussen.statustype_id as statype_id, statussen.datum as datum, erfgoed.naam as naam FROM erfgoedobjecten as erfgoed JOIN erfgoedobjecten_statussen as erfgoedobjectstatus ON erfgoed.id = erfgoedobjectstatus.erfgoedobject_id JO

Re: [sqlalchemy] Re: Query last relation created and attributes

2019-05-14 Thread Scheck David
Ok, I'll try to build this query in sql. thanks :) Le lun. 13 mai 2019 à 17:43, James Fennell a écrit : > I think Mike's suggestion was to construct the raw SQL string you want, > then reverse engineer to get the correct SQL Alchemy code, which you can > then use with your different models. For