Does SQLAlchemy discourage the modification of database schema by design?
-
This is a follow-up question to I am kinda confused on this design. Does SQLAlchemy discourage modification? In the FAQ they suggested us to use SQLAlchemy-Migrate (as in the previous question) and DDL API. Either way is not as straightforward as other applications of SQLAlchemy. So I guess the philosophy of SA is that we should not alter table frequently. I am a rookie in Database database schema by design. Is my guess right?
-
Answer:
Not altering tables frequently is more a philosophy of database design generally, than of SQLAlchemy specifically. But there are cases (our data warehousing application being one) where you do want to modify tables liberally, and SQLAlchemy does not hold you back. You must either (a) update and restart your app on DB schema changes, or (b) make it aware of such changes and able to discard and recreate any table and mapper instances it holds when they go out of sync with the DB. You probably don't want (b), being a self-confessed rookie in database schema design. But our data warehousing app does that merrily and constantly, and SQLAlchemy is serving us well for it. SQLAlchemy-Migrate helps you manage schema changes sensibly. That is certainly something you want to do, and people say SQLAlchemy-Migrate serves the purpose well (I haven't tried it myself; we use a homegrown system based on SQLAlchemy itself). Check out the book Refactoring Databases by Scott W. Ambler and Pramod J. Sadalage for more on sensibly managing database schema changes.
Gunnlaugur Ãór Briem at Quora Visit the source
Other answers
The recent preferred way is definitely (http://alembic.readthedocs.org/) which is written by Michael Bayer, the creator of SQLAlchemy.
Hong Minhee (æ´ª æ°æ)
Related Q & A:
- Is the modification a rational map?Best solution by Server Fault
- Does Restore "From database" restore from the most recent backup of the database or the actual live database?Best solution by Database Administrators
- How to create multiple index with sqlalchemy?Best solution by Stack Overflow
- How to do SQL inner queries through SQLAlchemy?Best solution by Stack Overflow
- How do you create temporary MySQL table in SQLAlchemy?Best solution by Stack Overflow
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.