Re: [sqlalchemy] automap with self-referential relationship

2017-04-03 Thread yoch . melka
Thank tou, I solved the problem with this code : def name_for_collection_relationship(base, local_cls, referred_cls, constraint): disc = '_'.join(col.name for col in constraint.columns) return referred_cls.__name__.lower() + '_' + disc + "_collection" Le lundi 3 avril 2017 17:41:20 UTC

Re: [sqlalchemy] automap with self-referential relationship

2017-04-03 Thread mike bayer
hi - this is perhaps a case automap should come up with something easier for, and at least have a note in the docs that refers to this specifically, however the general approach is to apply a naming convention to the relationships that will allow the conflict to resolve. you'd define name_f

[sqlalchemy] automap with self-referential relationship

2017-04-02 Thread yoch . melka
Hi, I want to use automap to generate mapping from existing database, but the relation mapping fails. I understand what happens, but I can't find a proper workaround to fix this error. Here a minimal code example with the minimal schema : CREATE TABLE `user` ( `id` INT UNSIGNED NOT NULL, PRI