[baseten-users] Problems with release 1.6
Tuukka Norri
tuukka.norri at karppinen.fi
Thu Apr 2 00:29:26 EEST 2009
Hi!
Jianhua Meng kirjoitti 1.4.2009 kello 18.58:
> We have been using a simple deployment process for installing
> baseten based apps on desired target machines without trouble until
> 1.6. The process consists of dumping the seed database which I use
> for development and use the dump to load any desired target computer
> for testing. The problem appears to be that on any target computer
> after the loading the database from the dump, the app gets stuck
> from an exception caused by 'Entity ... doesn't have relationship
> capability'.
Until version 1.6, we associated BaseTen's helper tables with user
tables by their names. This was rather error-prone, though, as all
special characters in relations' names weren't handled. Our
implementation of determining whether a relation was BaseTen enabled
or not, was also quite slow. To make the implementation simpler and
more efficient, we decided to derive the helper tables' names from
only the original relation's object identifier (oid).
The reason for the problem you're experiencing is that your relations
get different oids each time they get created, whereas BaseTen's
tables refer to the original oids. To solve it, you have two options,
which are admittedly worse than just dumping the database contents and
be done with it:
Firstly, don't include the BaseTen schema in your dump, and run
BaseTen Assistant each time you restore the dump.
Secondly, we do have the low-level SQL functions at your disposal.
Again, you shouldn't include the BaseTen schema in your dump. Here's a
brief tutorial:
– Load your database contents using pg_restore or psql.
– Load the BaseTen schema into the database. (m4
BaseTenModifications.sql.m4 > BaseTenModifications.sql; psql -f
BaseTenModifications.sql your_database)
– Perform a query that will enable your tables. Here's one that works
for multiple tables in the same schema:
SELECT baseten.enable (c.oid) FROM pg_class c INNER JOIN pg_namespace
n ON c.relnamespace = n.oid WHERE n.nspname = 'your_schema' AND
c.relname IN ('table_a', 'table_b', 'table_c');
– Finally perform a query like this:
SELECT baseten.refresh_caches ();
This does make restoring from backups lot less convenient. We'll see
if we can do something to simplify things, like provide a command-line
tool to do the tasks that BaseTen Assistant does.
> How does BaseTenAssistant tell if a table is enabled?
It looks if the table's oid is listed in baseten.enabled_relation.
--
Best regards,
Tuukka Norri
MK&C
More information about the baseten-users
mailing list