declarative mapper creates tables with coolumns in no particular order

Issue #1059 resolved
Former user created an issue

I've been moving most of my stuff over to declarative since I find that it reduces the amount of code quite a bit, and is more readable for non SA initiates on my project team. The only problem is, if I have a class like

__tablename__  = 'location_type'
id = Column(Integer, primary_key=True)
type = (String(32), unique = True, nullable = False)
creation_date = Column(yaddayadda)
comments = Column(String(255)

I end up with DDL that has the columns in reverse order:

CREATE TABLE location_type (
       comments VARCHAR(255),
       creation_date TIMESTAMP NOT NULL,
       type VARCHAR(32) NOT NULL,
       id INTEGER NOT NULL,
       CONSTRAINT location_type_pk PRIMARY KEY (id),
       CONSTRAINT location_type_uk  UNIQUE (type)
);

I find this frustrating. I'm aware that I can just fully declare the table, but I'd really like this as a feature to keep with the notion that using Declarative reduces the amount of code you need to write.

Comments (1)

  1. Log in to comment