Andrey Lebedev
2004-07-18 19:42:02 UTC
Hello,
I'm currently evaluating several object-relational mappings available
for python and I thing modeling is one of the best among them. However,
I need some clarification on how projects, that are based on modeling
framework, are supposed to be maintained.
As far as I understand, the framework is heavily relies on code
generation. Developer creates single XML or python file, describing data
model and then generates SQL schemas and python sources. Judging from
comments inside those generated python sources, they are intended to be
modified by developers after generation.
But what happens when database schema should be changed? What if there
are data in database that can't be lost just by deleting and recreating
tables? How to keep generated files' customizations after model
modifications?
The simplest procedure I can come up with is:
1. Change database on sql server using regular tools
2. Change generated files by adding get<attr>, set<attr> methods and
other necessary functions.
3. Change model file (actually I'm not sure it is nesessary)
The procedure is somewhat too complex, expecially because generated
python modules are not elementary and consist of relatively complex
statements to be written by hand each time database schema changes.
So, the question is: what, generally I have to do when I have, say,
developer and production project installations and I want add new column
to a table? How do you handle such situations?
Thanks in advance.
I'm currently evaluating several object-relational mappings available
for python and I thing modeling is one of the best among them. However,
I need some clarification on how projects, that are based on modeling
framework, are supposed to be maintained.
As far as I understand, the framework is heavily relies on code
generation. Developer creates single XML or python file, describing data
model and then generates SQL schemas and python sources. Judging from
comments inside those generated python sources, they are intended to be
modified by developers after generation.
But what happens when database schema should be changed? What if there
are data in database that can't be lost just by deleting and recreating
tables? How to keep generated files' customizations after model
modifications?
The simplest procedure I can come up with is:
1. Change database on sql server using regular tools
2. Change generated files by adding get<attr>, set<attr> methods and
other necessary functions.
3. Change model file (actually I'm not sure it is nesessary)
The procedure is somewhat too complex, expecially because generated
python modules are not elementary and consist of relatively complex
statements to be written by hand each time database schema changes.
So, the question is: what, generally I have to do when I have, say,
developer and production project installations and I want add new column
to a table? How do you handle such situations?
Thanks in advance.
--
Andrey Lebedev aka -.- . -.. -.. . .-.
Software engineer at UAB Mikromarketingas (http://micro.lt)
Homepage: http://micro.lt/~andrey/
Jabber ID: ***@jabber.ru
Andrey Lebedev aka -.- . -.. -.. . .-.
Software engineer at UAB Mikromarketingas (http://micro.lt)
Homepage: http://micro.lt/~andrey/
Jabber ID: ***@jabber.ru