importing sqlite data into a core data "database"
importing sqlite data into a core data "database"
- Subject: importing sqlite data into a core data "database"
- From: Steve Steinitz <email@hidden>
- Date: Sun, 13 Jul 2008 12:09:13 +1000
Hi John,
On 12/7/08, email@hidden wrote:
1) a) generate my application in XCode, use the sqlite storage option, put
in some dummy data, then use sqlite3 to explore the resulting schema, b)
transform my data into the new schema using sqlite3 and sql. Replace the
sqlite file created by my application with the new one containing my real
data.
Having played around with Core Data for a while my instinct is that
option 1 would present difficulties - Core data is particular
about the
database. Whenever, I've had to make a minor tweak to a core data
database outside of core data, I've had a sense of dread. I'd go
straight for option 2 without spending a second on option 1.
That said, go ahead and dabble briefly with option 1, maybe
you'll get
lucky. Remember to consider metadata.
2) writing an import routine for my application, using NSTask (?) and
sqlite3. This would likely only be used once.
I did something like that to bootstrap my point-of-sale
application. I
didn't use NSTask, I just wrote methods on the relevant window
controllers to import tab-delimited customer and product data
which I'd
exported from a filemaker database. I wrote nested loops to un-flatten
the data into a more sophisticated schema. Core data makes all that
pretty easy once you parse the tab-delimited data into objects, which
cocoa makes easy.
I thought, like you, that my code would only be used once but I
ended up
using it a dozen times while we were developing the app and
changing our
minds about the schema. And, if and when I have other customers
for the
app, I'll use it again.
Let me know if you'd like some relevant snippets.
Steve
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden