Please provide a simple, small example of your problem :-)
Also, is there a reason the order of column creation matters?
Chris
--
Simplistix - Content Management, Batch Processing & Python Consulting
- http://www.simplistix.co.uk
The Column object contains a "sort key" when constructed, against a single global value, that is used as a sort key when the Table is generated. This is to get around the fact that the attribute dictionary of the declarative class is unordered.
The mixin columns should copy their "sort key" over, or it should somehow be tailored in the declarative base so that the order of the two columns stays relatively the same, and perhaps is also tailored to be at the same position relative to the other columns in the ultimate table.
I'd welcome any patches in this regard since I don't usually deal with the "mixin" feature.
>
> The Column object contains a "sort key" when constructed, against a single global value, that is used as a sort key when the Table is generated. This is to get around the fact that the attribute dictionary of the declarative class is unordered.
>
> The mixin columns should copy their "sort key" over, or it should somehow be tailored in the declarative base so that the order of the two columns stays relatively the same, and perhaps is also tailored to be at the same position relative to the other columns in the ultimate table.
>
> I'd welcome any patches in this regard since I don't usually deal with the "mixin" feature.
fine, how about Chris works up the unit test for it:
diff -r af4bdd33564e lib/sqlalchemy/ext/declarative.py
--- a/lib/sqlalchemy/ext/declarative.py Thu Jul 01 16:57:02 2010 -0400
+++ b/lib/sqlalchemy/ext/declarative.py Thu Jul 01 20:25:59 2010 -0400
@@ -673,7 +673,8 @@
if name not in dict_ and not (
'__table__' in dict_ and name in dict_['__table__'].c
):
- potential_columns[name]=column_copies[obj]=obj.copy()
+ potential_columns[name] = column_copies[obj] = obj.copy()
+ column_copies[obj]._creation_order = obj._creation_order
elif isinstance(obj, RelationshipProperty):
raise exceptions.InvalidRequestError(
"relationships are not allowed on "
Done and pushed back to tip with the fix.
cheers,
Chris
Mike Lewis wrote:
> I'm trying to do some DDL creation with declarative base. THe problem
> I am running into is that I'm using a mixin, and it seems that the
> order the columns are being created in is different than the order
> they're declared with. Is there any way to control this?Please provide a simple, small example of your problem :-)
Also, is there a reason the order of column creation matters?
The Column object contains a "sort key" when constructed, against a single global value, that is used as a sort key when the Table is generated. This is to get around the fact that the attribute dictionary of the declarative class is unordered.
The mixin columns should copy their "sort key" over, or it should somehow be tailored in the declarative base so that the order of the two columns stays relatively the same, and perhaps is also tailored to be at the same position relative to the other columns in the ultimate table.
I'd welcome any patches in this regard since I don't usually deal with the "mixin" feature.
--
You received this message because you are subscribed to the Google Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+...@googlegroups.com.
To post to this group, send email to sqlal...@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.