test case:
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import DeclarativeMeta,
declarative_base
class DavBaseClass(DeclarativeMeta):
def __init__(self,ClassName,Bases,dict_):
dict_['displayname'] =
Column(Unicode(255),quote=True)
return DeclarativeMeta.__init__(self,ClassName,Bases,dict_)
Base = declarative_base(metaclass=DavBaseClass)
engine = create_engine('postgres://scott:[EMAIL PROTECTED]/test',
echo=True)
class Javascript(Base):
__tablename__ = "Javascript"
Id = Column(Integer, primary_key = True)
Source = Column(Unicode())
Minified = Column(Unicode())
Base.metadata.drop_all(engine)
Base.metadata.create_all(engine)
output (showing just the CREATE TABLE portion):
CREATE TABLE "Javascript" (
"Id" SERIAL NOT NULL,
"Source" VARCHAR,
"Minified" VARCHAR,
"displayname" VARCHAR(255),
PRIMARY KEY ("Id")
)
note that "quote=True" will not have this effect if you're using 0.4.
Also the quoting style you're using there seems to indicate the usage
of MySQL, but a datatype of VARCHAR on that platform would not be
accepted, so questions persist...
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---