On May 6, 2008, at 6:17 AM, Nagarajan wrote:
>
> All,
> I am a newbie to SQLAlchemy.
> I needed an ORM for my system and after a research, I decided on
> SQLAlchemy.
>
> I used SQLAutocode that generated this model.py (a snippet is pasted
> here)....
> -------------------------------------
> X----------------------------------------------------------
> Sources = Table('Sources', metadata,
> Column(u'id', PGInteger(), primary_key=True, nullable=False,
> default
> =PassiveDefault(u'nextval(\'"public"."Sources_id_seq"\'::regclass)')),
> Column(u'name', PGString(length=256,
> convert_unicode=False, assert_unicode=None), primary_key=False,
> nullable=False),
> Column(u'description', PGString(length=256,
> convert_unicode=False, assert_unicode=None), primary_key=False,
> nullable=False),
>
> schema='public'
> )
> class SourcesObject(object): pass
> mapper(SourcesObject, Sources)
that Table is a little messed up, in particular "default" doesnt take
a PassiveDefault as an argument. the "Sources_id_seq" is implicit
when the "id" column is created as SERIAL, but since im not sure how
this table is getting created, do it like this:
s = Table("Sources", metadata, Column('id', Integer,
Sequence("Sources_id_seq"), primary_key=True),
Column('name', String(256), nullable=False),
Column('description', String(256), nullable=False)
)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---