Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 01-08-2010, 06:37 AM   #1 (permalink)
Registered Member
 
Join Date: Jan 2010
Posts: 4
Bialetti is on a distinguished road
Default Using existing Sqlite DB with Core Data

I'm trying to implement a Core Data project which will have a database of locations.

I have the data in a csv file and also as a sqlite db. I would like to include the sqlite db with core data but this is not possible due to Core Data's treatment of sqlite (It includes two extra tables prefixed by Z_ amongst other things).

Has anyone got a working example of how to create a Core Data Sqlite DB that I can copy my existing information into or do they know how to convert a CSV file into a Core Data DB. The answers I found online don't include any detail they just give generic instructions such as "parse it into core data from csv without code examples or instruction".

Any help would be appreciated. As a newcomer I'm surprised that such an incompatability exists in the Core Data architecture.
Bialetti is offline   Reply With Quote
Old 01-08-2010, 08:18 AM   #2 (permalink)
Registered Member
 
Join Date: Jan 2010
Posts: 19
churn is on a distinguished road
Default

You must write a separate small conversion program (command line) to read your data from CSV or your existing sqlite db, create Core Data objects, and then save.
churn is offline   Reply With Quote
Old 01-08-2010, 08:19 AM   #3 (permalink)
Senior Member
iPhone Dev SDK Supporter
 
Join Date: Nov 2009
Posts: 179
thewitt is on a distinguished road
Default

Remember that CoreData can use any data store - and just so happens to use SQLite on the iPhone.

You can continue to use your SQLite database directly on the iPhone if you want - there is no requirement to convert to CoreData.

I don't know of any conversion utilities or examples, sorry.

-t
thewitt is offline   Reply With Quote
Old 01-08-2010, 04:14 PM   #4 (permalink)
Registered Member
 
Join Date: Jan 2010
Posts: 4
Bialetti is on a distinguished road
Default

Thanks thewitt.

Does anyone have any suggestions for importing their data in to CoreData?

In every language I've ever done this is exceptionally easy - strange how Apple's own examples don't provide a way of importing the information into a Core Data store.

Has anybody on the forum any experience of doing this or does everyone use native sqlite or fmdb?

Quote:
Originally Posted by thewitt View Post
Remember that CoreData can use any data store - and just so happens to use SQLite on the iPhone.

You can continue to use your SQLite database directly on the iPhone if you want - there is no requirement to convert to CoreData.

I don't know of any conversion utilities or examples, sorry.

-t
Bialetti is offline   Reply With Quote
Old 08-02-2011, 01:40 AM   #5 (permalink)
Registered Member
 
Join Date: May 2009
Location: Krala,India
Posts: 32
preethaAjayan is on a distinguished road
Default

THis may be helpful.

Core Data Tutorial: How To Preload/Import Existing Data | Ray Wenderlich
preethaAjayan is offline   Reply With Quote
Reply

Bookmarks

Tags
core data, csv, database, sqlite

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 338
14 members and 324 guests
akacaj, alexP, ClerurcifeDer, Domele, Duncan C, givensur, GraffitiCircus, JmayLive, michelle, NetGuru, NSString, Paul Slocum, Sloshmonster, soohyun
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,650
Threads: 94,114
Posts: 402,883
Top Poster: BrianSlick (7,990)
Welcome to our newest member, soohyun
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 09:51 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0