i've playing with runtime sqlalchemy model management, and was thinking
another way to implement this without using a versioned schema, would be
by instead having a method on the schema/engine for autoloading existing
tables from the database and comparing to the in memory table objects,
and generating alter ddl as appropriate or altering the in memory model
dependending on the sync direction. it would need a table subclass and
custom metaclass to get around the existing singleton table metaclass.
- kapil
Gambit wrote:
Hi Michael -
Thanks for the interesting read.
I'm not looking for something that will necessarily require a
VersionedTable or the equivalent. The personal fear I'm working against
is that I will neglect to remember/record/identify a change made in the
schema while generating my DDL update scripts. Yes, I keep a changelog,
yes I record everything, but I'm not above making mistakes. So, I'm
looking for suggestions on how I can either automatically generate DDL
changesets -- not failsafe, but ones I can then scan for completeness
and use as a platform -- or aid me in verifying that I have indeed
identified all the changes made between two schemas. If people are
doing things as simple as a pg_dump of the DDL and then running it
through diff, that's great, but if there are other tools or
methodologies available then I'd love to hear about them :)
This is why I am asking this in respect to SqlAlchemy. SA supports
building a representation of the database in code, what's needed, first,
is a way to save/load that representation -- this may be useful for
other purposes -- and then second generate a delta between two. This
delta can even be as simple as making ORIG the equivilent of NEW and
recording the subsequently generated ALTER statements.
Or it may be significantly more difficult!
--G
At 22:15 06/03/2006, Michael Bayer wrote:
i am sure Jonathan will speak up on this one.
or ill just point you to the blog entry.... http://
spyced.blogspot.com/2006/02/why-schema-definition-belongs-in.html
As for me, I am not *so* opinionated as to say schema management
tools are inherently bad, although I probably wouldnt use them either.
But if someone wants to build such a tool using SQLAlchemy as the
backend for it, thats fine with me...I dont think SA would need any
design modifications of its own, i.e. you could model your own ALTER
TABLE objects and whatever else in an external package, building them
upon the SA schema framework. You probably would want to subclass
Table or compose it into a bigger object like a VersionedTable or
something like that.
as for SQLAlchemy core id say its out of scope....SA has a big enough
task as it is right now.
On Mar 6, 2006, at 2:34 PM, Gambit wrote:
Hi guys -
I'm looking at various tools for tracking schema changes on the
backend database and generate change scripts for user upgrades.
There's a handful of tools out there, most of them fairly
expensive, but I thought I'd ask if SQLAlchemy could be used for
this kind of purpose. With the reflection mechanism, it becomes
possible to at least load the entire schema into python, what's
needed is for some way to persist or "snapshot" the schema, and
then either upgrade or compare against another snapshot.
Any suggestions for tools, procedures, or "yeah, this would be
useful!" comments are welcome :)
Cheers,
--G
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting
language
that extends applications into web and mobile media. Attend the
live webcast
and join the prime developer group breaking into this new coding
territory!
http://sel.as-us.falkag.net/sel?
cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live
webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Sqlalchemy-users mailing list
Sqlalchemy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users