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
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
-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
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
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
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),
@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