Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for a USING clause when altering a column's type in PostgreSQL #292

Closed
sqlalchemy-bot opened this issue Apr 13, 2015 · 5 comments

Comments

@sqlalchemy-bot
Copy link

Migrated issue, originally created by Wouter Bolsterlee (@wbolster)

When changing a column's type, it is sometimes necessary to specify how to convert the existing value into a value of the new type. This is done using the USING clause of the SET DATA TYPE clause of the ALTER TABLE statement. See http://www.postgresql.org/docs/9.4/static/sql-altertable.html for details.

Currently it seems impossible to specify the USING clause using Alembic's op. alter_column(). It would be great if something like alter_column(using="convert_from(data, 'utf-8')::jsonb") would work.

@sqlalchemy-bot
Copy link
Author

Changes by Wouter Bolsterlee (@wbolster):

  • changed title from "Add support for a ALTER COLUMN USING ... in Postgr" to "Add support for a USING clause when altering a col"

@sqlalchemy-bot
Copy link
Author

Michael Bayer (@zzzeek) wrote:

it would be called postgresql_using. I can accept this as a PR which would alter the alembic/ddl/postgresql.py dialect to support this flag, in a similar way as something like "mssql_drop_foreign" in alembic/ddl/mssql.py.

@sqlalchemy-bot
Copy link
Author

Michael Bayer (@zzzeek) wrote:

Support USING for Postgresql ALTER COLUMN.

Added support for the USING clause to the ALTER COLUMN operation
for Postgresql. Support is via the
:paramref:.op.alter_column.postgresql_using
parameter.

Fixes: #292
Change-Id: I8b1d418df0b6b731a68614dbffd7a9fb13de4de5
Pull-request: zzzeek/alembic#27

84b9298

@sqlalchemy-bot
Copy link
Author

Changes by Michael Bayer (@zzzeek):

  • changed status to closed

@sqlalchemy-bot
Copy link
Author

Michael Bayer (@zzzeek) wrote:

Issue #39 was marked as a duplicate of this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant