0

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?

MathMan
  • 5
  • 3
  • Do you want to change the database schema or select results from two tables? – Bulat Aug 04 '15 at 14:40
  • All the elements in Table A and Table B come from a table F. I just want to copy C5 in table A and move it to table B – MathMan Aug 04 '15 at 14:43

1 Answers1

1

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,

Community
  • 1
  • 1
ApolloFortyNine
  • 570
  • 2
  • 7
  • [`alembic`](http://alembic.readthedocs.org/en/latest/) is worth looking into if database schema changes are needed. – alecxe Aug 04 '15 at 15:09