[sqlalchemy] Re: Bulk creation of columns

2011-09-22 Thread pravin battula
You need to create new Column objects for each table because the table objects take ownership of the passed in columns. I think that is what i'm doing,creating new column objects for 2 columns and first appending it to the table object and then trying to create those columns using

Re: [sqlalchemy] Re: object_session returns None, but state still has session_id

2011-09-22 Thread Ben Ford
Hi Mike, It is an edge case for sure. I'm using SA with eventlet so the session is going out of scope in a green thread. Eventlet does some monkeying (literally) around with threadlocals so I get a different session for each one. However in this case the parent instance to which I'm adding obj

RE: [sqlalchemy] Bulk creation of columns

2011-09-22 Thread King Simon-NFHD78
-Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalchemy@googlegroups.com] On Behalf Of pravin battula Sent: 21 September 2011 12:54 To: sqlalchemy@googlegroups.com Subject: [sqlalchemy] Bulk creation of columns Hi, How can i create columns in bulk using

Re: [sqlalchemy] Re: object_session returns None, but state still has session_id

2011-09-22 Thread Michael Bayer
On Sep 22, 2011, at 5:04 AM, Ben Ford wrote: Hi Mike, It is an edge case for sure. I'm using SA with eventlet so the session is going out of scope in a green thread. Eventlet does some monkeying (literally) around with threadlocals so I get a different session for each one. However in

[sqlalchemy] SQLAchemy architecture in slides

2011-09-22 Thread Victor Olex
It is worth mentioning that Mike has published slides from his PyGotham talk on SQLAlchemy architecture, which also covered certain internal algorithms. http://techspot.zzzeek.org/2011/09/16/sqlalchemy-at-pygotham/ I am looking forward to watching the video, which should help me get a grasp of

[sqlalchemy] using @declared_attr to define a column in an actual class (non-mixin)

2011-09-22 Thread Yap Sok Ann
With this code: from sqlalchemy.ext.declarative import declarative_base, declared_attr from sqlalchemy.schema import Column from sqlalchemy.types import Integer, String Base = declarative_base() class Mixin(object): @declared_attr def attr2(cls): return Column(String(20),

Re: [sqlalchemy] using @declared_attr to define a column in an actual class (non-mixin)

2011-09-22 Thread Michael Bayer
@declared_attr when used for attributes outside of __table_args__, __tablename__ and __mapper_args__ is only recognized on a mixin, or on a class that uses a new directive __abstract__ = True. It's skipped on mapped classes when used for plain column attributes since inheriting from a mapped