MathMan
MathMan

Reputation: 5

Python/SQL: move column in table A to table B

I have connected to a sql database through python using sql alchemy. I have a table called A and another table called B. The data from A and B comes from table F.

         **A**                         **B**
C1  C2  C3  C4  C5             D1    D2    D3   D4   D5

I was wondering if it is possible to take column C5 and insert it into table B such that table B looks like:

       **B**
D1  D2  D3  D4  D5  C5

I haven't come across any direct methods to do this. Has anyone figured out a way to approach this?

Upvotes: 0

Views: 460

Answers (1)

ApolloFortyNine
ApolloFortyNine

Reputation: 590

SQLAlchemy doesn't support modifying tables after creation.

add column to SQLAlchemy Table

This is referred to as database migration (SQLAlchemy doesn't support migration out of the box). You can look at using sqlalchemy-migrate to help in these kinds of situations, or you can just ALTER TABLE through your chosen database's command line utility,

Upvotes: 1

Related Questions