Skip navigation.
 
mlRe: Using in CoreData an SQLite database created in a non CoreData app
FROM : Alexander Lamb
DATE : Tue Aug 08 08:55:31 2006

Ok,

From this answer and another one privatly received, I understand 
CoreData is not meant to reverse engineer a database (as you would 
have done with EOF to get to some existing data).
I still think there is something like a generic importer which could 
be made.
I will therefore follow the advice:

- use an Objective-C or C API to read in the SQLite original data
- use CoreData to resave the data in the CoreData store

Thanks,

Alex
--
Alexander Lamb
<email_removed>



On Aug 7, 2006, at 5:02 PM, David Emme wrote:

>
> On Aug 7, 2006, at 5:05 AM, Alexander Lamb wrote:
>

>> I managed to export some data (Access) to an SQLite3 database on 
>> Windows (after setting the legacy_file_format PRAGMA for MacOSX 
>> compatibility) through an ODBC adaptor.
>>
>> Now I have this SQLite3 database on MacOSX I would like to use as 
>> a data store/source for a CoreData application.
>>
>> It doesn't work because:
>>
>> 1) The CoreData metadata is missing
>> 2) The table names don't match.
>>
>> [...]
>> How can I map the tables, since CoreData seems to create 
>> Znameoftable instead of nameoftable.

>
> I'm definitely no expert, but I've been doing some CoreData work 
> lately, and looking at the SQLite tables that are generated. Some 
> of the results have been surprising. It's definitely more than just 
> prepending a "Z" onto table names. For example, in one case my data 
> model had two related entities and I expected to see an SQLite 
> table for each. Instead, the records were merged into a single table!
>
> Bottom line, I think the safest (and possibly the best) way for you 
> to proceed is to write a simple importer to read your SQLite tables 
> (check out QuickLite) and write the results into CoreData entities. 
> (Or else just forget about CoreData and use QuickLite in your app.) 
> Otherwise, unless your tables are arranged, and tables and fields 
> named, exactly the way CoreData expects (demonstrably *not* 
> necessarily obvious), then, as we say, "you will surely loose".
>
> Good Luck!
> -Dave
> --
> Irreverence is the champion of liberty, and its only sure defense.
>     -- Mark Twain
>
>

Related mailsAuthorDate
mlUsing in CoreData an SQLite database created in a non CoreData app Alexander Lamb Aug 7, 14:05
mlRe: Using in CoreData an SQLite database created in a non CoreData app David Emme Aug 7, 17:02
mlRe: Using in CoreData an SQLite database created in a non CoreData app Alexander Lamb Aug 8, 08:55