Re: [sqlalchemy] bug with declarative's _decl_class_registry

2010-10-06 Thread Chris Withers

On 05/10/2010 18:03, Michael Bayer wrote:



Also, is there a 'trunk' or 'tip' anywhere now to put 0.7-targeted code?


there's not.  You'd make a bitbucket repo and link to it on the trac ticket.


Done:

http://www.sqlalchemy.org/trac/changeset/6868:d8580d6765d4

http://www.sqlalchemy.org/trac/ticket/1937

http://www.sqlalchemy.org/trac/ticket/1938

Chris

--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



Re: [sqlalchemy] bug with declarative's _decl_class_registry

2010-10-05 Thread Michael Bayer

On Oct 5, 2010, at 12:37 PM, Chris Withers wrote:

> On 05/10/2010 16:10, Michael Bayer wrote:
>>> I think an exception should be raised if a class name already exists in 
>>> _decl_class_registry when the assignment is made in _as_declarative.
>> 
>> yeah definitely, though in 0.6 it needs to be a warning to start since some 
>> folks might be doing this semi-intentionally.
> 
> What could the intention possibly be?

they named two classes the same thing, they happened to have configured 
relationship() using the class object and not the string registry, and their 
app works.  If 0.6 turns that into an exception they get sudden application 
failure upgrading on a minor point release.

> 
> Also, is there a 'trunk' or 'tip' anywhere now to put 0.7-targeted code?

there's not.  You'd make a bitbucket repo and link to it on the trac ticket.


-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



Re: [sqlalchemy] bug with declarative's _decl_class_registry

2010-10-05 Thread Chris Withers

On 05/10/2010 16:10, Michael Bayer wrote:

I think an exception should be raised if a class name already exists in 
_decl_class_registry when the assignment is made in _as_declarative.


yeah definitely, though in 0.6 it needs to be a warning to start since some 
folks might be doing this semi-intentionally.


What could the intention possibly be?

Also, is there a 'trunk' or 'tip' anywhere now to put 0.7-targeted code?

Chris

--
Simplistix - Content Management, Batch Processing & Python Consulting
   - http://www.simplistix.co.uk

--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.



Re: [sqlalchemy] bug with declarative's _decl_class_registry

2010-10-05 Thread Michael Bayer

On Oct 5, 2010, at 11:04 AM, Chris Withers wrote:

> Hi All,
> 
> Start off with a base.py module:
> 
> from sqlalchemy.ext.declarative import declarative_base
> Base = declarative_base()
> 
> Now, say we have a module, a.py:
> 
> from sqlalchemy import *
> from base import Base
> 
> class Something(Base):
>__tablename__ = 'foo'
>id = Column('id', Integer, primary_key=True)
> 
> ...and another module, b.py:
> 
> from sqlalchemy import *
> from base import Base
> 
> class Something(Base):
>__tablename__ = 'bar'
>id = Column('id', Integer, primary_key=True)
> 
> ...and finally, a third module, c.py:
> 
> from sqlalchemy import *
> from sqlalchemy.orm import relationship
> from base import Base
> 
> import a,b
> 
> class AnotherThing(Base):
>__tablename__ = 'baz'
>id = Column('id', Integer, primary_key=True)
>addresses = relationship("Something")
> 
> ...what table will that relationship be to?
> 
> >>> import c
> >>> c.AnotherThing._decl_class_registry['Something']
> 
> 
> I think an exception should be raised if a class name already exists in 
> _decl_class_registry when the assignment is made in _as_declarative.

yeah definitely, though in 0.6 it needs to be a warning to start since some 
folks might be doing this semi-intentionally.


> Are there any cases where it would be legit to have one class override 
> another in _decl_class_registry in this way?
> If the answer is no, I'll commit a test and patch asap...
> 
> cheers,
> 
> Chris
> 
> PS: Also, in the above, how come no foreign keys are created?

theres no usage of ForeignKey() or ForeignKeyConstraint().


-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalch...@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.