[baseten-users] Problems with release 1.6

Jianhua Meng jh_meng at mac.com
Thu Apr 2 00:52:37 EEST 2009


Thanks Tuukka for the suggested options and the possibility of a  
command line tool to alleviate the restore. See me comments below.

On Apr 1, 2009, at 2:29 PM, Tuukka Norri wrote:

> 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.
>
A tool like this would be nice.  The need to be able to restore a  
database from a dump is unavoidable, even critical to the viability of  
a baseten based app, or any database based app. A command line tool is  
very desirable because we can write a script to load the database and  
load the baseten schema. Ideally your command line tool would do the  
dump and restore all in the same tool.

>> 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
>
> _______________________________________________
> baseten-users mailing list
> baseten-users at lists.basetenframework.org
> http://lists.basetenframework.org/mailman/listinfo/baseten-users

Regards,
Jianhua Meng









More information about the baseten-users mailing list