BaseTen supports entities based on views as well as those based on physical tables. Like other entities, an entity based on a view needs one or more primary key columns, based on which the object ids are generated. Since PostgreSQL doesn't support constraints on views, the primary key columns of a view have to be specified within the BaseTen schema. This can be done easily with BaseTen Assistant.
Using relationships is also possible. The views will be aware of foreign keys if the foreign key columns are included in the view and have the same names as in the underlying physical tables. Retrieving objects from related tables is possible using -[BXDatabaseObject valueForKey:]. Relationships will be formed with the original target tables and also with views based on them. For performance reasons, view dependencies are cached into tables in BaseTen schema. They can be updated by running BaseTen Assistant.
