Re: [sqlalchemy] DeferredReflection with optional tables

2016-09-09 Thread bsdz
Thank you very much. That worked :) On Wednesday, 7 September 2016 14:56:25 UTC+1, Mike Bayer wrote: > > > > On 09/07/2016 05:08 AM, bsdz wrote: > > No worries and thanks for the suggestions/advice so far. > > > > Tbh I tried the mixin approach first as described in the docs but had > > probl

Re: [sqlalchemy] DeferredReflection with optional tables

2016-09-07 Thread Mike Bayer
On 09/07/2016 05:08 AM, bsdz wrote: No worries and thanks for the suggestions/advice so far. Tbh I tried the mixin approach first as described in the docs but had problems when trying to query anything on the 2nd class. This is a boiled down version of what I tried: the result doesn't make

Re: [sqlalchemy] DeferredReflection with optional tables

2016-09-07 Thread bsdz
No worries and thanks for the suggestions/advice so far. Tbh I tried the mixin approach first as described in the docs but had problems when trying to query anything on the 2nd class. This is a boiled down version of what I tried: import sqlalchemy as sa from sqlalchemy.orm import sessionmake

Re: [sqlalchemy] DeferredReflection with optional tables

2016-09-06 Thread Mike Bayer
On 09/06/2016 12:50 PM, bsdz wrote: Thanks for your reply. I think you misread my code. The method "remove" does exist. It's a method of MetaData and not tables. See http://docs.sqlalchemy.org/en/rel_1_0/core/metadata.html#sqlalchemy.schema.MetaData. I did misread. I'm not sure about au

Re: [sqlalchemy] DeferredReflection with optional tables

2016-09-06 Thread bsdz
Thanks for your reply. I think you misread my code. The method "remove" does exist. It's a method of MetaData and not tables. See http://docs.sqlalchemy.org/en/rel_1_0/core/metadata.html#sqlalchemy.schema.MetaData. I'm not sure about automap. I'm not keen on reflecting all the tables in my da

Re: [sqlalchemy] DeferredReflection with optional tables

2016-09-06 Thread Mike Bayer
On 09/06/2016 09:50 AM, bsdz wrote: Hi I am trying to implement optional tables with DeferredReflection. The idea is in different environments certain tables might exist while not in others. I have tried removing the tables from the metadata for the declarative base if the table's info doesn'

[sqlalchemy] DeferredReflection with optional tables

2016-09-06 Thread bsdz
Hi I am trying to implement optional tables with DeferredReflection. The idea is in different environments certain tables might exist while not in others. I have tried removing the tables from the metadata for the declarative base if the table's info doesn't list the environment (see below) b