Cookbook recipe for re-ordering columns isn't working? #1192
-
Out of an abundance of curiosity (and unbelievably fussy pickiness), I'm trying out the recipe here to order my columns in autogenerated tables. I've copied the code verbatim into my
This is alembic v1.10, Python 3.11. I do have three schemas in play, each with ~5-10 tables in them. There are cross schema constraints and such, but what's odd to me is that taking the TIA for any pointers, advice, brickbats. Cheers! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
it's likely the recipe broke either due to an alembic or a SQLAlchemy release. if you have time, maybe try SQLAlchemy 1.4 and/or an older version of Alembic. Otherwise someone here will run the recipe and see where it broke... |
Beta Was this translation helpful? Give feedback.
-
Well, some hapless fumbling, and it looks like there's a bunch of stuff hanging on the return ops.CreateTableOp(
op.table_name,
columns=columns,
schema=op.schema,
info=op.info,
comment=op.comment,
prefixes=op.prefixes,
_namespace_metadata=op._namespace_metadata,
_constraints_included=op._constraints_included,
**op.kw
) Now, to tilt at the next windmill -- adding a trigger automatically for tables with certain predicates. Wheee! |
Beta Was this translation helpful? Give feedback.
Well, some hapless fumbling, and it looks like there's a bunch of stuff hanging on the
CreateTableOp
that wasn't getting copied to the newCreateTableOp
statement with the re-ordered columns. I added a very ugly bit and now it seems to be ... ok?Now, to tilt at the next windmill -- adding a trigger automatically for tables with certain predicates. Wheee!