On Apr 6, 2008, at 22:44, mmalc crawford wrote:
The fact that Core Data is an object graph management and persistence framework does not in an of itself preclude it from reverse engineering an existing database. EOF is also an "object graph management and persistence framework" but it is able to create a model by interrogating a database. Core Data happens not to have that functionality.
In its current architectural incarnation, Core Data's use of a sqlite- based store (when so configured) is a clever implementation detail, not an exposure of any putative internal database capabilities. Reverse engineering an existing database in Core Data's current incarnation would be a kind of hackery, and therefore likely to break in future incarnations.
It would be one thing for Core Data to create *a* model by interrogating a database, but in its current incarnation the sqlite persistent store it would require to support that model would not be the database you started with. The first part of that seems like it would pretty easy to add to Core Data (and it would probably be fairly easy to have it import the database content too); the second part sounds hard.
The first part of that [auto-modeling and auto-importing] sounds like something that an enterprising third-party developer could do (and would probably be useful to a *lot* of people). The second part [connecting to existing sqlite databases as persistent stores] would likely break Apple's performance tuning and turn Core Data into a dog, unless Apple started over.
Putting the issue of using an existing database aside, although Core Data is not inherently a database system, it is fairly easy to use it to implement the functionality of a database system. However, because it is not inherently a database system, its not automatically going to have the desirable characteristics of a database system, in terms of performance, scalability, archivability, robustness to schema changes, and perhaps other measures of database goodness.
Another way of saying this is that we have to regard Core Data as destroying (well, "masking" might be more accurate) the databaseness of the sqlite stores it uses, from the point of view of its client code. Simply using an existing database as the persistent store, if it were possible now, wouldn't put the databaseness back in. That specific point, I assume, is why Apple explicitly warns that "Core Data is not a RDBMS."
Anything is possible in a future incarnation of Core Data, but the OP did ask, "*Is* there a reasonable way to get core data to use an existing database...?" (my emphasis).
_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]