[Scons-users] database builder

Gary Oberbrunner garyo at oberbrunner.com
Sat Apr 13 09:51:17 EDT 2013


While this is a cool idea, I don't think SCons would actually be that
helpful. I'd start by looking at how Rails migrations work. Schema
updates should be defined by the db developer; I don't think trying to diff
schemas (with SCons or any tool) will actually get you where you need.
There's often queries that need to be run when updating a schema for
instance, to compute values for a new column or set the default value or
other things. You could certainly *drive* the migration process out of
SCons, but even there I don't think SCons's dependency analysis will be all
that helpful -- I'd just use os.system() to kick off your migration script
(or make it be a python function and just execute it straight out of your
SConstruct).

That's my opinion anyway.



On Sat, Apr 13, 2013 at 5:34 AM, Philipp Kraus
<philipp.kraus at flashpixx.de>wrote:


> Hi,

>

> I'm searching for database support in Scons something like databse

> installation and updating. I'm often work with database and do the

> installation with SQL scripts,

> but the client is compiled and installed with Scons, so can be this an

> idea for Scons? Do you think this is a good & meningful feature?

> At the moment I run env.Command with the database command-line client, but

> the updating process can not work / can only work with deleting & creating

> the database.

>

> I think a feature like this

> env.CreateDatabase("localhost:5432", databse="testdb", user"=myself",

> password="1234", type="postgresql", source="database.sql.scons")

>

> should be nice, also an env.UpdateDatabase which updates the database

> without deleting tables, it creates only alter statements and run these

> statements for the update process.

> Scons can handle this calls in an transaction for atomic calls and uses

> Pythons database packages. The database script should be more than a plain

> text file, so Scons can

> check the database and create individual statements during the update

> process.

>

> My idea is, that the Scons database.sql.scons file is a XML files which

> descriptes tables, indicies, references datatypes (validation via XSD)....

> On the createdatabase Scons transform this data with XSLT into SQL or walk

> through the XML tree and creates on-fly the statements and send it over

> Python Database API

> The update is more difficult, because I must create a diff between

> installed tables and new table definition. I think a post- / preprocessing

> should be also in it, so the user

> can run some codes before / after the update for modifying datasets.

>

> Hope for some comments :-)

> Have a nice weekend

>

> Phil

> _______________________________________________

> Scons-users mailing list

> Scons-users at scons.org

> http://four.pairlist.net/mailman/listinfo/scons-users

>




--
Gary
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20130413/f9539a77/attachment.htm>


More information about the Scons-users mailing list