Incorrect schema generated for table

Issue #1659 resolved
Former user created an issue

I tested the following code in SQLAlchemy v0.5.8 and the trunk (r6669).

from sqlalchemy import Column, Integer, String, create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker

engine = create_engine('sqlite:///test.sqlite', echo=True)
Session = sessionmaker(bind=engine)
Base = declarative_base()

class Dummy(Base):
    __tablename__ = 'dummy'
    id = Column(Integer, primary_key=True)
    name = Column(String)
    month12 = Column('12month', Integer)

Base.metadata.create_all(engine)

In SQLAlchemy v0.5.8, the schema generated for the table is:

CREATE TABLE dummy (
        id INTEGER NOT NULL,
        name VARCHAR,
        "12month" INTEGER,
        PRIMARY KEY (id)
)

In the trunk r6669, it is:

CREATE TABLE dummy (
    id INTEGER NOT NULL, 
    name VARCHAR, 
    12month INTEGER, 
    PRIMARY KEY (id)
)

The schema generated in the trunk doesn't work as the column name 12month has not been quoted properly.

Comments (2)

  1. Log in to comment