Re: [sqlalchemy] SAWarnings when using history_meta.py versioning and Inheritance.

2014-10-21 Thread JPLaverdure
I fully agree with you and had forgotten that "version" was part of the 
primary key.
I believe I made the appropriate changes to history_meta.py and will submit 
a pull request shortly

As always, thanks for your help !

JP

On Tuesday, 21 October 2014 14:41:15 UTC-4, Michael Bayer wrote:
>
> “version” is part of the primary key and is FK’ed to the superclass table, 
> so the warning isn’t generated for that one.
>
> it wouldn’t be appropriate for a datetime “changed” to have a foreign key. 
>  IMO it only needs to be on the base table.
>
>
>
>
> On Oct 21, 2014, at 2:35 PM, JPLaverdure  > wrote:
>
> Hi Michael,
>
> I quite agree that child entities don't need their own copy of the 
> "changed" attribute, but this is also the way that the "version" attribute 
> is handled.
> (ie: both parent and child entities have their own copy of "version")
> Is there any way we can fix the both of them ?
>
> As for the option to remove the "changed" attribute... Well, I'm the one 
> who suggested its addition and submitted the pull request :)
>
> Thanks,
>
> JP
>
> On Friday, 17 October 2014 16:05:15 UTC-4, Michael Bayer wrote:
>>
>>
>> On Oct 17, 2014, at 3:50 PM, JPLaverdure  wrote:
>>
>> Hi Michael,
>>
>> My bad, they do indeed only show up on mapping... which takes place when 
>> my pyramid app instantiates. Sorry for the confusion :)
>> Still, they could be unnerving for someone deploying the app. Any way to 
>> not have these show up ?
>> I did look into version_meta.py and tried to make some tweaks when I saw 
>> anything having to do with the version atribute.. But to no avail.
>>
>> Your help is greatly appreciated !
>>
>>
>> it’s not clear why a class that inherits from another needs a separate 
>> “changed” column in any case. The recipe indicates on line 68 this 
>> column is optional so I’d remove it, or just make it conditional if 
>> “super_mapper” is not present to have it only on the base table.   or maybe 
>> just map it differently, or not at all, down where it calls mapper():
>>
>> m = mapper(
>> versioned_cls,
>> table,
>> inherits=super_history_mapper,
>> polymorphic_on=polymorphic_on,
>> polymorphic_identity=local_mapper.polymorphic_identity,
>> exclude_columns=[‘changed’]
>> )
>>
>>
>>
>>
>>
>>
>>
>> JP   
>>
>> On Friday, 17 October 2014 14:52:22 UTC-4, JPLaverdure wrote:
>>>
>>> Hello,
>>>
>>> It seems a number of SAWarnings are being thrown whenever I instantiate 
>>> Versioned objects which make use of inheritance:
>>>
>>> SAWarning: Implicitly combining column container_history.changed with 
>>> column barcoded_container_history.changed under attribute 'changed'.  
>>> Please configure one or more attributes for these same-named columns 
>>> explicitly.
>>> prop = self._property_from_column(key, prop)
>>>
>>> Unfortunately, since these objects are instantiated "auto-magically" by 
>>> the Versioned mixin class, I can't see a way to make these go away or 
>>> address the issue.
>>> I tried looking into the history_meta.py source and cannot understand 
>>> why this same warning is not being thrown for the "version" attribute.
>>>
>>> Anyone has an idea ?
>>>
>>> Thanks !
>>>
>>> JP
>>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "sqlalchemy" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to sqlalchemy+...@googlegroups.com.
>> To post to this group, send email to sqlal...@googlegroups.com.
>> Visit this group at http://groups.google.com/group/sqlalchemy.
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sqlalchemy+...@googlegroups.com .
> To post to this group, send email to sqlal...@googlegroups.com 
> .
> Visit this group at http://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


Re: [sqlalchemy] SAWarnings when using history_meta.py versioning and Inheritance.

2014-10-21 Thread Michael Bayer
“version” is part of the primary key and is FK’ed to the superclass table, so 
the warning isn’t generated for that one.

it wouldn’t be appropriate for a datetime “changed” to have a foreign key.  IMO 
it only needs to be on the base table.




> On Oct 21, 2014, at 2:35 PM, JPLaverdure  wrote:
> 
> Hi Michael,
> 
> I quite agree that child entities don't need their own copy of the "changed" 
> attribute, but this is also the way that the "version" attribute is handled.
> (ie: both parent and child entities have their own copy of "version")
> Is there any way we can fix the both of them ?
> 
> As for the option to remove the "changed" attribute... Well, I'm the one who 
> suggested its addition and submitted the pull request :)
> 
> Thanks,
> 
> JP
> 
> On Friday, 17 October 2014 16:05:15 UTC-4, Michael Bayer wrote:
> 
>> On Oct 17, 2014, at 3:50 PM, JPLaverdure > 
>> wrote:
>> 
>> Hi Michael,
>> 
>> My bad, they do indeed only show up on mapping... which takes place when my 
>> pyramid app instantiates. Sorry for the confusion :)
>> Still, they could be unnerving for someone deploying the app. Any way to not 
>> have these show up ?
>> I did look into version_meta.py and tried to make some tweaks when I saw 
>> anything having to do with the version atribute.. But to no avail.
>> 
>> Your help is greatly appreciated !
> 
> it’s not clear why a class that inherits from another needs a separate 
> “changed” column in any case. The recipe indicates on line 68 this column 
> is optional so I’d remove it, or just make it conditional if “super_mapper” 
> is not present to have it only on the base table.   or maybe just map it 
> differently, or not at all, down where it calls mapper():
> 
> m = mapper(
> versioned_cls,
> table,
> inherits=super_history_mapper,
> polymorphic_on=polymorphic_on,
> polymorphic_identity=local_mapper.polymorphic_identity,
> exclude_columns=[‘changed’]
> )
> 
> 
> 
> 
> 
> 
>> 
>> JP   
>> 
>> On Friday, 17 October 2014 14:52:22 UTC-4, JPLaverdure wrote:
>> Hello,
>> 
>> It seems a number of SAWarnings are being thrown whenever I instantiate 
>> Versioned objects which make use of inheritance:
>> 
>> SAWarning: Implicitly combining column container_history.changed with column 
>> barcoded_container_history.changed under attribute 'changed'.  
>> Please configure one or more attributes for these same-named columns 
>> explicitly.
>> prop = self._property_from_column(key, prop)
>> 
>> Unfortunately, since these objects are instantiated "auto-magically" by the 
>> Versioned mixin class, I can't see a way to make these go away or address 
>> the issue.
>> I tried looking into the history_meta.py source and cannot understand why 
>> this same warning is not being thrown for the "version" attribute.
>> 
>> Anyone has an idea ?
>> 
>> Thanks !
>> 
>> JP
>> 
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "sqlalchemy" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to sqlalchemy+...@googlegroups.com .
>> To post to this group, send email to sqlal...@googlegroups.com .
>> Visit this group at http://groups.google.com/group/sqlalchemy 
>> .
>> For more options, visit https://groups.google.com/d/optout 
>> .
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sqlalchemy+unsubscr...@googlegroups.com 
> .
> To post to this group, send email to sqlalchemy@googlegroups.com 
> .
> Visit this group at http://groups.google.com/group/sqlalchemy 
> .
> For more options, visit https://groups.google.com/d/optout 
> .

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


Re: [sqlalchemy] SAWarnings when using history_meta.py versioning and Inheritance.

2014-10-21 Thread JPLaverdure
Hi Michael,

I quite agree that child entities don't need their own copy of the 
"changed" attribute, but this is also the way that the "version" attribute 
is handled.
(ie: both parent and child entities have their own copy of "version")
Is there any way we can fix the both of them ?

As for the option to remove the "changed" attribute... Well, I'm the one 
who suggested its addition and submitted the pull request :)

Thanks,

JP

On Friday, 17 October 2014 16:05:15 UTC-4, Michael Bayer wrote:
>
>
> On Oct 17, 2014, at 3:50 PM, JPLaverdure  > wrote:
>
> Hi Michael,
>
> My bad, they do indeed only show up on mapping... which takes place when 
> my pyramid app instantiates. Sorry for the confusion :)
> Still, they could be unnerving for someone deploying the app. Any way to 
> not have these show up ?
> I did look into version_meta.py and tried to make some tweaks when I saw 
> anything having to do with the version atribute.. But to no avail.
>
> Your help is greatly appreciated !
>
>
> it’s not clear why a class that inherits from another needs a separate 
> “changed” column in any case. The recipe indicates on line 68 this 
> column is optional so I’d remove it, or just make it conditional if 
> “super_mapper” is not present to have it only on the base table.   or maybe 
> just map it differently, or not at all, down where it calls mapper():
>
> m = mapper(
> versioned_cls,
> table,
> inherits=super_history_mapper,
> polymorphic_on=polymorphic_on,
> polymorphic_identity=local_mapper.polymorphic_identity,
> exclude_columns=[‘changed’]
> )
>
>
>
>
>
>
>
> JP   
>
> On Friday, 17 October 2014 14:52:22 UTC-4, JPLaverdure wrote:
>>
>> Hello,
>>
>> It seems a number of SAWarnings are being thrown whenever I instantiate 
>> Versioned objects which make use of inheritance:
>>
>> SAWarning: Implicitly combining column container_history.changed with 
>> column barcoded_container_history.changed under attribute 'changed'.  
>> Please configure one or more attributes for these same-named columns 
>> explicitly.
>> prop = self._property_from_column(key, prop)
>>
>> Unfortunately, since these objects are instantiated "auto-magically" by 
>> the Versioned mixin class, I can't see a way to make these go away or 
>> address the issue.
>> I tried looking into the history_meta.py source and cannot understand why 
>> this same warning is not being thrown for the "version" attribute.
>>
>> Anyone has an idea ?
>>
>> Thanks !
>>
>> JP
>>
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sqlalchemy+...@googlegroups.com .
> To post to this group, send email to sqlal...@googlegroups.com 
> .
> Visit this group at http://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


Re: [sqlalchemy] SAWarnings when using history_meta.py versioning and Inheritance.

2014-10-17 Thread Michael Bayer

> On Oct 17, 2014, at 3:50 PM, JPLaverdure  wrote:
> 
> Hi Michael,
> 
> My bad, they do indeed only show up on mapping... which takes place when my 
> pyramid app instantiates. Sorry for the confusion :)
> Still, they could be unnerving for someone deploying the app. Any way to not 
> have these show up ?
> I did look into version_meta.py and tried to make some tweaks when I saw 
> anything having to do with the version atribute.. But to no avail.
> 
> Your help is greatly appreciated !

it’s not clear why a class that inherits from another needs a separate 
“changed” column in any case. The recipe indicates on line 68 this column 
is optional so I’d remove it, or just make it conditional if “super_mapper” is 
not present to have it only on the base table.   or maybe just map it 
differently, or not at all, down where it calls mapper():

m = mapper(
versioned_cls,
table,
inherits=super_history_mapper,
polymorphic_on=polymorphic_on,
polymorphic_identity=local_mapper.polymorphic_identity,
exclude_columns=[‘changed’]
)






> 
> JP   
> 
> On Friday, 17 October 2014 14:52:22 UTC-4, JPLaverdure wrote:
> Hello,
> 
> It seems a number of SAWarnings are being thrown whenever I instantiate 
> Versioned objects which make use of inheritance:
> 
> SAWarning: Implicitly combining column container_history.changed with column 
> barcoded_container_history.changed under attribute 'changed'.  
> Please configure one or more attributes for these same-named columns 
> explicitly.
> prop = self._property_from_column(key, prop)
> 
> Unfortunately, since these objects are instantiated "auto-magically" by the 
> Versioned mixin class, I can't see a way to make these go away or address the 
> issue.
> I tried looking into the history_meta.py source and cannot understand why 
> this same warning is not being thrown for the "version" attribute.
> 
> Anyone has an idea ?
> 
> Thanks !
> 
> JP
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sqlalchemy+unsubscr...@googlegroups.com 
> .
> To post to this group, send email to sqlalchemy@googlegroups.com 
> .
> Visit this group at http://groups.google.com/group/sqlalchemy 
> .
> For more options, visit https://groups.google.com/d/optout 
> .

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


Re: [sqlalchemy] SAWarnings when using history_meta.py versioning and Inheritance.

2014-10-17 Thread Mike Bayer

On 10/17/2014 02:52 PM, JPLaverdure wrote:
> Hello,
>
> It seems a number of SAWarnings are being thrown whenever I
> instantiate Versioned objects which make use of inheritance:
>
> |
> SAWarning:Implicitlycombining column container_history.changed
> withcolumn barcoded_container_history.changed under attribute 'changed'. 
> Pleaseconfigure one ormore attributes forthese same-named columns
> explicitly.
> prop =self._property_from_column(key,prop)
> |
>
> Unfortunately, since these objects are instantiated "auto-magically"
> by the Versioned mixin class, I can't see a way to make these go away
> or address the issue.
> I tried looking into the history_meta.py source and cannot understand
> why this same warning is not being thrown for the "version" attribute.
>
> Anyone has an idea ?

this is a newer warning which refers to the fact that these two columns
are separate but placed under the same attribute.  in some cases, people
didn't expect this to happen so hence a warning.   the recipe might be
taking this into account for "version", not sure.  it can be fixed in
the recipe but the warning should only be raised at mapping time, not at
instantiation time.





>
> Thanks !
>
> JP
> -- 
> You received this message because you are subscribed to the Google
> Groups "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to sqlalchemy+unsubscr...@googlegroups.com
> .
> To post to this group, send email to sqlalchemy@googlegroups.com
> .
> Visit this group at http://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.