db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Scott Eade <se...@backstagetech.com.au>
Subject Logical vs. physical db names - expanding the role of torque.database.name
Date Wed, 05 Feb 2003 04:04:07 GMT
I am a little confused about which properties to set in order to obtain the
optimal separation between logical and physical database names (I suspect
that I am not confused and that torque does not currently cater for this).

Here is what I desire:

1. At runtime I want Torque.properties to connect a physical database to a
logical database name used internally by torque.  This seems to work well
now, the sample Torque.properties file makes the configuration of this
fairly obvious (including the ability to deal with multiple databases).

2. I don't want to have to regenerate my om layer when the physical database
name changes.  This means that the DATABASE_NAME constants generated by
torque:om should use the logical database name.  This works as long as the
logical name is used as the name attribute of the database element in the

3. I still want to be able to use torque:create-db, torque:sql, etc. to
generate scripts to create the physical database.  This is where torque
breaks down - the logical name is used where a physical name should be used.
The trouble is of course that there is no property defined to specify the
physical database name (the torque.database.name property is only used by
torque:dumpdata according to the documentation, and we can't extract the
name from torque.database.url because there is no single defined format for
the url).  The solution would appear to be to update these targets so that
torque.database.name is in fact used to provide the physical database name.
Changing the name attribute of the database element in the schema to the
desired physical database name will result in the correct sql being
generated, but then the physical db name being used for the constants in the

A few other notes:
* create-db.sql - appears to use the name attribute of the database element
in the schema.  The value of torque.database.name should be used instead.
* sql - appears to use something other than the name attribute of the
database element in the schema, but still the wrong value (logical rather
than physical
* om - appears to use the name attribute of the database element in the
schema.  This provides the correct behaviour.
* I haven't yet checked id-table-init-sql, insert-sql or any other relevant

Existing potential sources of logical and physical names:
1. the name of the schema file - the documentation seems to imply that this
is significant, but I don't think it is.
2. the name attribute of the database element within the schema file - my
preference is for this to be the logical database name, otherwise I need to
alter the schema if a different physical database name needs to be used.
3. the torque.database.name property - only seems to be used by
torque:dumpdata (at least according to the documentation)
4. the torque.project property - this is a potential source for the logical
database name, but item 2 above seems much more appropriate to me.  So what
else is this property good for?
5. the torque.database.default property - this is used at runtime to
determine which of multiple logical databases is the default one to use
(i.e. It is not relevant/may not exist at generation time)

In summary, I propose that we expand the role of the torque.database.name
property to be used as the physical database name where appropriate.

What do others think?

Scott Eade
Backstage Technologies Pty. Ltd.
.Mac Chat/AIM: seade at mac dot com

View raw message